remarkable_rails 3.0.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. data/CHANGELOG +44 -44
  2. data/LICENSE +1 -1
  3. data/README +83 -83
  4. data/lib/remarkable_rails/action_controller/base.rb +24 -24
  5. data/lib/remarkable_rails/action_controller/macro_stubs.rb +493 -493
  6. data/lib/remarkable_rails/action_controller/matchers/assign_to_matcher.rb +72 -72
  7. data/lib/remarkable_rails/action_controller/matchers/filter_params_matcher.rb +21 -21
  8. data/lib/remarkable_rails/action_controller/matchers/redirect_to_matcher.rb +112 -112
  9. data/lib/remarkable_rails/action_controller/matchers/render_template_matcher.rb +140 -140
  10. data/lib/remarkable_rails/action_controller/matchers/respond_with_matcher.rb +118 -118
  11. data/lib/remarkable_rails/action_controller/matchers/route_matcher.rb +51 -51
  12. data/lib/remarkable_rails/action_controller/matchers/set_session_matcher.rb +103 -103
  13. data/lib/remarkable_rails/action_controller/matchers/set_the_flash_matcher.rb +50 -50
  14. data/lib/remarkable_rails/action_view/base.rb +1 -1
  15. data/lib/remarkable_rails/action_view.rb +16 -16
  16. data/lib/remarkable_rails/active_orm.rb +2 -2
  17. data/locale/en.yml +74 -74
  18. data/spec/action_controller/assign_to_matcher_spec.rb +68 -68
  19. data/spec/action_controller/filter_params_matcher_spec.rb +42 -42
  20. data/spec/action_controller/macro_stubs_spec.rb +17 -17
  21. data/spec/action_controller/redirect_to_matcher_spec.rb +60 -60
  22. data/spec/action_controller/render_template_matcher_spec.rb +227 -227
  23. data/spec/action_controller/respond_with_matcher_spec.rb +189 -189
  24. data/spec/action_controller/route_matcher_spec.rb +75 -75
  25. data/spec/action_controller/set_session_matcher_spec.rb +43 -43
  26. data/spec/action_controller/set_the_flash_matcher_spec.rb +1 -1
  27. data/spec/application/application.rb +14 -14
  28. data/spec/application/tasks_controller.rb +34 -34
  29. data/spec/functional_builder.rb +93 -93
  30. data/spec/spec_helper.rb +44 -44
  31. metadata +4 -4
@@ -1,251 +1,251 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
3
  describe 'render_template' do
4
- include FunctionalBuilder
5
-
4
+ include FunctionalBuilder
5
+
6
6
  describe 'messages' do
7
- before(:each) do
8
- build_response { render :action => 'new' }
7
+ before(:each) do
8
+ build_response { render :action => 'new' }
9
9
  @matcher = render_template('edit')
10
10
  end
11
11
 
12
- it 'should contain a description message' do
13
- @matcher.description.should == 'render template "edit"'
14
-
15
- @matcher.layout('application')
16
- @matcher.description.should == 'render template "edit" and with layout "application"'
17
-
18
- @matcher.layout(nil)
19
- @matcher.description.should == 'render template "edit" and with no layout'
20
-
21
- @matcher.content_type(Mime::XML).matches?(@controller)
22
- @matcher.description.should == 'render template "edit", with no layout, and with content type "application/xml"'
12
+ it 'should contain a description message' do
13
+ @matcher.description.should == 'render template "edit"'
14
+
15
+ @matcher.layout('application')
16
+ @matcher.description.should == 'render template "edit" and with layout "application"'
17
+
18
+ @matcher.layout(nil)
19
+ @matcher.description.should == 'render template "edit" and with no layout'
20
+
21
+ @matcher.content_type(Mime::XML).matches?(@controller)
22
+ @matcher.description.should == 'render template "edit", with no layout, and with content type "application/xml"'
23
23
  end
24
24
 
25
- it 'should set rendered? message' do
26
- build_response
25
+ it 'should set rendered? message' do
26
+ build_response
27
27
  @matcher.matches?(@controller)
28
- @matcher.failure_message.should == 'Expected template "edit" to be rendered, got no render'
28
+ @matcher.failure_message.should == 'Expected template "edit" to be rendered, got no render'
29
29
  @matcher.negative_failure_message.should == 'Did not expect template "edit" to be rendered, got no render'
30
30
  end
31
-
32
- # Is not possible to check extensions on Rails 2.1
31
+
32
+ # Is not possible to check extensions on Rails 2.1
33
33
  unless RAILS_VERSION =~ /^2.1/
34
34
  it 'should set template_matches? message' do
35
35
  @matcher.matches?(@controller)
36
- @matcher.failure_message.should == 'Expected template "edit" to be rendered, got "examples/new.html.erb"'
37
- end
38
- end
39
-
40
- it 'should set layout_matches? message' do
41
- @matcher = render_template('new')
36
+ @matcher.failure_message.should == 'Expected template "edit" to be rendered, got "examples/new.html.erb"'
37
+ end
38
+ end
39
+
40
+ it 'should set layout_matches? message' do
41
+ @matcher = render_template('new')
42
42
  @matcher.layout('users').matches?(@controller)
43
- @matcher.failure_message.should == 'Expected to render with layout "users", got nil'
43
+ @matcher.failure_message.should == 'Expected to render with layout "users", got nil'
44
44
  end
45
45
  end
46
46
 
47
- describe 'matcher' do
48
-
49
- [ :controller, :response ].each do |subject_name|
50
- describe "with #{subject_name} subject" do
51
-
52
- describe 'rendering a template' do
53
- before(:each) do
54
- build_response { render :action => :new }
55
- @subject = instance_variable_get("@#{subject_name}")
56
- end
57
-
58
- it { @subject.should render_template('new') }
59
- it { @subject.should render_template('new.html') }
60
- it { @subject.should render_template('new.html.erb') }
61
- it { @subject.should render_template('examples/new') }
62
- it { @subject.should render_template('examples/new.html') }
63
- it { @subject.should render_template('examples/new.html.erb') }
64
-
65
- it { @subject.should_not render_template('edit') }
66
- it { @subject.should_not render_template('projects/new') }
67
- it { @subject.should_not render_template('examples/edit') }
68
- end
69
-
70
- describe 'rendering a template with path' do
71
- before(:each) do
72
- build_response { render :template => 'projects/new' }
73
- @subject = instance_variable_get("@#{subject_name}")
74
- end
75
-
76
- it { @subject.should render_template('projects/new') }
77
- it { @subject.should render_template('projects/new.html') }
78
- it { @subject.should render_template('projects/new.html.erb') }
79
-
80
- it { @subject.should_not render_template('new') }
81
- it { @subject.should_not render_template('examples/new') }
82
- it { @subject.should_not render_template('projects/edit') }
83
- end
84
-
85
- describe 'rendering a template with extention xml.builder' do
86
- before(:each) do
87
- build_response { respond_to{ |format| format.xml } }
88
- @subject = instance_variable_get("@#{subject_name}")
89
- end
90
-
91
- it { @subject.should render_template('example') }
92
- it { @subject.should render_template('example.xml') }
93
- it { @subject.should render_template('example.xml.builder') }
94
- it { @subject.should render_template('examples/example') }
95
- it { @subject.should render_template('examples/example.xml') }
96
- it { @subject.should render_template('examples/example.xml.builder') }
97
-
98
- # Is not possible to check extensions on Rails 2.1
99
- unless RAILS_VERSION =~ /^2.1/
100
- it { @subject.should_not render_template('example.html') }
101
- it { @subject.should_not render_template('example.html.erb') }
102
- it { @subject.should_not render_template('example.html.builder') }
103
- it { @subject.should_not render_template('examples/example.html') }
104
- it { @subject.should_not render_template('examples/example.html') }
105
- it { @subject.should_not render_template('examples/example.html.erb') }
106
- end
107
- end
108
-
109
- describe 'rendering a partial' do
110
- before(:each) do
111
- build_response { render :partial => 'example' }
112
- @subject = instance_variable_get("@#{subject_name}")
113
- end
114
-
115
- it { @subject.should render_template('_example') }
116
- it { @subject.should render_template('_example.html') }
117
- it { @subject.should render_template('_example.html.erb') }
118
- it { @subject.should render_template('examples/_example') }
119
- it { @subject.should render_template('examples/_example.html') }
120
- it { @subject.should render_template('examples/_example.html.erb') }
121
-
122
- it { @subject.should_not render_template('example') }
123
- it { @subject.should_not render_template('example.html') }
124
- it { @subject.should_not render_template('example.html.erb') }
125
- it { @subject.should_not render_template('examples/example') }
126
- it { @subject.should_not render_template('examples/example.html') }
127
- it { @subject.should_not render_template('examples/example.html.erb') }
128
- end
129
-
130
- end
131
- end
132
-
133
- describe 'render_with_layout' do
134
- before(:each){ build_response { render :layout => 'examples' } }
135
-
136
- it { should render_with_layout('examples') }
137
- it { should_not render_with_layout('users') }
138
- it { should_not render_with_layout(nil) }
139
- it { should_not render_without_layout }
140
-
141
- it { should render_template.layout('examples') }
142
- it { should_not render_template.layout('users') }
143
- it { should_not render_template.layout(nil) }
144
- end
145
-
146
- describe 'render_without_layout' do
147
- before(:each){ build_response }
148
-
149
- it { should render_without_layout }
150
- it { should_not render_with_layout('examples') }
151
-
152
- it { should render_without_layout }
153
- it { should_not render_with_layout('examples') }
154
- end
47
+ describe 'matcher' do
48
+
49
+ [ :controller, :response ].each do |subject_name|
50
+ describe "with #{subject_name} subject" do
51
+
52
+ describe 'rendering a template' do
53
+ before(:each) do
54
+ build_response { render :action => :new }
55
+ @subject = instance_variable_get("@#{subject_name}")
56
+ end
57
+
58
+ it { @subject.should render_template('new') }
59
+ it { @subject.should render_template('new.html') }
60
+ it { @subject.should render_template('new.html.erb') }
61
+ it { @subject.should render_template('examples/new') }
62
+ it { @subject.should render_template('examples/new.html') }
63
+ it { @subject.should render_template('examples/new.html.erb') }
64
+
65
+ it { @subject.should_not render_template('edit') }
66
+ it { @subject.should_not render_template('projects/new') }
67
+ it { @subject.should_not render_template('examples/edit') }
68
+ end
69
+
70
+ describe 'rendering a template with path' do
71
+ before(:each) do
72
+ build_response { render :template => 'projects/new' }
73
+ @subject = instance_variable_get("@#{subject_name}")
74
+ end
75
+
76
+ it { @subject.should render_template('projects/new') }
77
+ it { @subject.should render_template('projects/new.html') }
78
+ it { @subject.should render_template('projects/new.html.erb') }
79
+
80
+ it { @subject.should_not render_template('new') }
81
+ it { @subject.should_not render_template('examples/new') }
82
+ it { @subject.should_not render_template('projects/edit') }
83
+ end
84
+
85
+ describe 'rendering a template with extention xml.builder' do
86
+ before(:each) do
87
+ build_response { respond_to{ |format| format.xml } }
88
+ @subject = instance_variable_get("@#{subject_name}")
89
+ end
90
+
91
+ it { @subject.should render_template('example') }
92
+ it { @subject.should render_template('example.xml') }
93
+ it { @subject.should render_template('example.xml.builder') }
94
+ it { @subject.should render_template('examples/example') }
95
+ it { @subject.should render_template('examples/example.xml') }
96
+ it { @subject.should render_template('examples/example.xml.builder') }
97
+
98
+ # Is not possible to check extensions on Rails 2.1
99
+ unless RAILS_VERSION =~ /^2.1/
100
+ it { @subject.should_not render_template('example.html') }
101
+ it { @subject.should_not render_template('example.html.erb') }
102
+ it { @subject.should_not render_template('example.html.builder') }
103
+ it { @subject.should_not render_template('examples/example.html') }
104
+ it { @subject.should_not render_template('examples/example.html') }
105
+ it { @subject.should_not render_template('examples/example.html.erb') }
106
+ end
107
+ end
108
+
109
+ describe 'rendering a partial' do
110
+ before(:each) do
111
+ build_response { render :partial => 'example' }
112
+ @subject = instance_variable_get("@#{subject_name}")
113
+ end
114
+
115
+ it { @subject.should render_template('_example') }
116
+ it { @subject.should render_template('_example.html') }
117
+ it { @subject.should render_template('_example.html.erb') }
118
+ it { @subject.should render_template('examples/_example') }
119
+ it { @subject.should render_template('examples/_example.html') }
120
+ it { @subject.should render_template('examples/_example.html.erb') }
121
+
122
+ it { @subject.should_not render_template('example') }
123
+ it { @subject.should_not render_template('example.html') }
124
+ it { @subject.should_not render_template('example.html.erb') }
125
+ it { @subject.should_not render_template('examples/example') }
126
+ it { @subject.should_not render_template('examples/example.html') }
127
+ it { @subject.should_not render_template('examples/example.html.erb') }
128
+ end
129
+
130
+ end
131
+ end
132
+
133
+ describe 'render_with_layout' do
134
+ before(:each){ build_response { render :layout => 'examples' } }
135
+
136
+ it { should render_with_layout('examples') }
137
+ it { should_not render_with_layout('users') }
138
+ it { should_not render_with_layout(nil) }
139
+ it { should_not render_without_layout }
140
+
141
+ it { should render_template.layout('examples') }
142
+ it { should_not render_template.layout('users') }
143
+ it { should_not render_template.layout(nil) }
144
+ end
145
+
146
+ describe 'render_without_layout' do
147
+ before(:each){ build_response }
148
+
149
+ it { should render_without_layout }
150
+ it { should_not render_with_layout('examples') }
151
+
152
+ it { should render_without_layout }
153
+ it { should_not render_with_layout('examples') }
154
+ end
155
155
  end
156
156
 
157
- describe 'macro' do
158
-
159
- describe 'rendering a template' do
160
- before(:each) { build_response { render :action => :new } }
161
-
162
- should_render_template 'new'
163
- should_render_template 'new.html'
164
- should_render_template 'new.html.erb'
165
- should_render_template 'examples/new'
166
- should_render_template 'examples/new.html'
167
- should_render_template 'examples/new.html.erb'
168
-
169
- should_not_render_template 'edit'
170
- should_not_render_template 'projects/new'
171
- should_not_render_template 'examples/edit'
172
- end
173
-
174
- describe 'rendering a template with path' do
175
- before(:each) { build_response { render :template => 'projects/new' } }
176
-
177
- should_render_template 'projects/new'
178
- should_render_template 'projects/new.html'
179
- should_render_template 'projects/new.html.erb'
180
-
181
- should_not_render_template 'new'
182
- should_not_render_template 'examples/new'
183
- should_not_render_template 'projects/edit'
184
- end
185
-
186
- describe 'rendering a template with extention xml.builder' do
187
- before(:each) { build_response { respond_to{ |format| format.xml } } }
188
-
189
- should_render_template 'example'
190
- should_render_template 'example.xml'
191
- should_render_template 'example.xml.builder'
192
- should_render_template 'examples/example'
193
- should_render_template 'examples/example.xml'
194
- should_render_template 'examples/example.xml.builder'
195
-
196
- # Is not possible to check extensions on Rails 2.1
197
- unless RAILS_VERSION =~ /^2.1/
198
- should_not_render_template 'example.html'
199
- should_not_render_template 'example.html.erb'
200
- should_not_render_template 'example.html.builder'
201
- should_not_render_template 'examples/example.html'
202
- should_not_render_template 'examples/example.html'
203
- should_not_render_template 'examples/example.html.erb'
204
- end
205
- end
206
-
207
- describe 'rendering a partial' do
208
- before(:each) { build_response { render :partial => 'example' } }
209
-
210
- should_render_template '_example'
211
- should_render_template '_example.html'
212
- should_render_template '_example.html.erb'
213
- should_render_template 'examples/_example'
214
- should_render_template 'examples/_example.html'
215
- should_render_template 'examples/_example.html.erb'
216
-
217
- should_not_render_template 'example'
218
- should_not_render_template 'example.html'
219
- should_not_render_template 'example.html.erb'
220
- should_not_render_template 'examples/example'
221
- should_not_render_template 'examples/example.html'
222
- should_not_render_template 'examples/example.html.erb'
223
- end
224
-
225
- describe 'render_with_layout' do
226
- before(:each){ build_response { render :layout => 'examples' } }
227
-
228
- should_render_with_layout 'examples'
229
- should_not_render_with_layout 'users'
230
- should_not_render_with_layout nil
231
-
232
- should_render_template :layout => 'examples'
233
- should_not_render_template :layout => 'users'
234
- should_not_render_template :layout => nil
235
- end
236
-
237
- describe 'render_without_layout' do
238
- before(:each){ build_response }
239
-
240
- should_render_without_layout
241
- should_not_render_with_layout 'examples'
242
-
243
- should_render_without_layout
244
- should_not_render_with_layout 'examples'
245
- end
157
+ describe 'macro' do
158
+
159
+ describe 'rendering a template' do
160
+ before(:each) { build_response { render :action => :new } }
161
+
162
+ should_render_template 'new'
163
+ should_render_template 'new.html'
164
+ should_render_template 'new.html.erb'
165
+ should_render_template 'examples/new'
166
+ should_render_template 'examples/new.html'
167
+ should_render_template 'examples/new.html.erb'
168
+
169
+ should_not_render_template 'edit'
170
+ should_not_render_template 'projects/new'
171
+ should_not_render_template 'examples/edit'
172
+ end
173
+
174
+ describe 'rendering a template with path' do
175
+ before(:each) { build_response { render :template => 'projects/new' } }
176
+
177
+ should_render_template 'projects/new'
178
+ should_render_template 'projects/new.html'
179
+ should_render_template 'projects/new.html.erb'
180
+
181
+ should_not_render_template 'new'
182
+ should_not_render_template 'examples/new'
183
+ should_not_render_template 'projects/edit'
184
+ end
185
+
186
+ describe 'rendering a template with extention xml.builder' do
187
+ before(:each) { build_response { respond_to{ |format| format.xml } } }
188
+
189
+ should_render_template 'example'
190
+ should_render_template 'example.xml'
191
+ should_render_template 'example.xml.builder'
192
+ should_render_template 'examples/example'
193
+ should_render_template 'examples/example.xml'
194
+ should_render_template 'examples/example.xml.builder'
195
+
196
+ # Is not possible to check extensions on Rails 2.1
197
+ unless RAILS_VERSION =~ /^2.1/
198
+ should_not_render_template 'example.html'
199
+ should_not_render_template 'example.html.erb'
200
+ should_not_render_template 'example.html.builder'
201
+ should_not_render_template 'examples/example.html'
202
+ should_not_render_template 'examples/example.html'
203
+ should_not_render_template 'examples/example.html.erb'
204
+ end
205
+ end
206
+
207
+ describe 'rendering a partial' do
208
+ before(:each) { build_response { render :partial => 'example' } }
209
+
210
+ should_render_template '_example'
211
+ should_render_template '_example.html'
212
+ should_render_template '_example.html.erb'
213
+ should_render_template 'examples/_example'
214
+ should_render_template 'examples/_example.html'
215
+ should_render_template 'examples/_example.html.erb'
216
+
217
+ should_not_render_template 'example'
218
+ should_not_render_template 'example.html'
219
+ should_not_render_template 'example.html.erb'
220
+ should_not_render_template 'examples/example'
221
+ should_not_render_template 'examples/example.html'
222
+ should_not_render_template 'examples/example.html.erb'
223
+ end
224
+
225
+ describe 'render_with_layout' do
226
+ before(:each){ build_response { render :layout => 'examples' } }
227
+
228
+ should_render_with_layout 'examples'
229
+ should_not_render_with_layout 'users'
230
+ should_not_render_with_layout nil
231
+
232
+ should_render_template :layout => 'examples'
233
+ should_not_render_template :layout => 'users'
234
+ should_not_render_template :layout => nil
235
+ end
236
+
237
+ describe 'render_without_layout' do
238
+ before(:each){ build_response }
239
+
240
+ should_render_without_layout
241
+ should_not_render_with_layout 'examples'
242
+
243
+ should_render_without_layout
244
+ should_not_render_with_layout 'examples'
245
+ end
246
246
  end
247
-
248
- generate_macro_stubs_specs_for(:render_template, 'new')
249
- generate_macro_stubs_specs_for(:render_with_layout, 'examples')
247
+
248
+ generate_macro_stubs_specs_for(:render_template, 'new')
249
+ generate_macro_stubs_specs_for(:render_with_layout, 'examples')
250
250
  generate_macro_stubs_specs_for(:render_without_layout)
251
251
  end