Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 193
- Log:
First stage commit of Typo 4.1, modified for the ROOL site.
Includes all local modifications but a final pass needs to be
made to delete any files left over from earlier Typo versions
that shouldn't be here anymore. See the 'tags' section of the
repository for a clean Typo 4.1 tree.Note that symlinks to shared files in the RISC OS Open theme
directory have been deliberately included this time around; I
decided that on balance it was better to leave them in as
placeholders, since unlike symlinks in app/views/shared, the
Typo theme structure is not a standard Rails concept.
- Author:
- rool
- Date:
- Wed Apr 04 18:51:02 +0100 2007
- Size:
- 3938 Bytes
1 | require File.dirname(__FILE__) + '/../spec_helper' |
2 | |
3 | module StateSpecHelper |
4 | def content_should_delegate_method_to_state(method, *expected_args) |
5 | if expected_args.blank? |
6 | expected_args << :no_args |
7 | end |
8 | |
9 | @state.should_receive(method).with(*expected_args).and_return(true) |
10 | method_args = *(expected_args)[1..-1] |
11 | |
12 | if method_args.blank? |
13 | @content.send(method).should_be true |
14 | else |
15 | @content.send(method, *method_args).should_be true |
16 | end |
17 | end |
18 | end |
19 | |
20 | context 'With new content and a mocked state...' do |
21 | include StateSpecHelper |
22 | |
23 | setup do |
24 | @state = mock('state', :null_object => true) |
25 | @state.stub!(:memento).and_return('ContentState::Unclassified') |
26 | ContentState::Unclassified.stub!(:instance).and_return(@state) |
27 | @content = Comment.new(:author => 'Piers', :body => 'Body') |
28 | end |
29 | |
30 | specify '#published? should delegate to state' do |
31 | content_should_delegate_method_to_state :published?, @content |
32 | end |
33 | |
34 | specify '#just_published? should delegate to state' do |
35 | content_should_delegate_method_to_state :just_published? |
36 | end |
37 | |
38 | specify '#just_changed_published_status? should delegate to state' do |
39 | content_should_delegate_method_to_state :just_changed_published_status? |
40 | end |
41 | |
42 | specify '#withdrawn? should delegate to state' do |
43 | content_should_delegate_method_to_state :withdrawn? |
44 | end |
45 | |
46 | specify '#publication_pending? should delegate to state' do |
47 | content_should_delegate_method_to_state :publication_pending? |
48 | end |
49 | |
50 | specify '#post_trigger should delegate to state' do |
51 | content_should_delegate_method_to_state :post_trigger, @content |
52 | end |
53 | |
54 | specify '#after_save should delegate to state' do |
55 | content_should_delegate_method_to_state :after_save, @content |
56 | end |
57 | |
58 | specify '#send_notifications should delegate to state' do |
59 | content_should_delegate_method_to_state :send_notifications, @content |
60 | end |
61 | |
62 | specify '#withdraw should delegate to state' do |
63 | content_should_delegate_method_to_state :withdraw, @content |
64 | end |
65 | |
66 | specify '#published= should delegate to state' do |
67 | @state.should_receive(:change_published_state).with(@content, true).and_return(true) |
68 | @content.published = true |
69 | end |
70 | |
71 | specify '#published_at= should delegate to state' do |
72 | timestamp = Time.now |
73 | @state.should_receive(:set_published_at).with(@content, timestamp).and_return(true) |
74 | @content.published_at = timestamp |
75 | end |
76 | |
77 | |
78 | end |
79 | |
80 | context 'Given a comment and mocked state' do |
81 | include StateSpecHelper |
82 | |
83 | setup do |
84 | @state = mock('state', :null_object => true) |
85 | @state.stub!(:memento).and_return('ContentState::Unclassified') |
86 | ContentState::Unclassified.stub!(:instance).and_return(@state) |
87 | @content = Comment.new(:author => 'Piers', :body => 'Body') |
88 | end |
89 | |
90 | specify '#spam? should delegate to state' do |
91 | @state.should_receive(:is_spam?).with(@content).and_return(true) |
92 | @content.spam?.should == true |
93 | end |
94 | |
95 | specify '#status_confirmed? should delegate to state' do |
96 | content_should_delegate_method_to_state :status_confirmed?, @content |
97 | end |
98 | |
99 | specify '#mark_as_ham should delegate to state' do |
100 | content_should_delegate_method_to_state :mark_as_ham, @content |
101 | end |
102 | |
103 | specify '#mark_as_spam should delegate to state' do |
104 | content_should_delegate_method_to_state :mark_as_spam, @content |
105 | end |
106 | |
107 | specify '#confirm_classification should delegate to state' do |
108 | content_should_delegate_method_to_state :confirm_classification, @content |
109 | end |
110 | end |
111 | |
112 | context 'Given an article and mocked state' do |
113 | include StateSpecHelper |
114 | |
115 | setup do |
116 | @state = mock('state', :null_object => true) |
117 | @state.stub!(:memento).and_return('ContentState::New') |
118 | ContentState::New.stub!(:instance).and_return(@state) |
119 | @content = Article.new(:author => 'Piers', :title => 'title', :body => 'Body') |
120 | end |
121 | |
122 | specify '#send_pings should delegate to state' do |
123 | @state.should_receive(:send_pings).and_return(true) |
124 | @content.send_pings.should_be true |
125 | end |
126 | end |