remarkable_rails 3.0.0
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.
- data/CHANGELOG +81 -0
- data/LICENSE +20 -0
- data/README +2 -0
- data/lib/remarkable_rails/action_controller/base.rb +31 -0
- data/lib/remarkable_rails/action_controller/macro_stubs.rb +518 -0
- data/lib/remarkable_rails/action_controller/matchers/assign_to_matcher.rb +94 -0
- data/lib/remarkable_rails/action_controller/matchers/filter_params_matcher.rb +41 -0
- data/lib/remarkable_rails/action_controller/matchers/redirect_to_matcher.rb +119 -0
- data/lib/remarkable_rails/action_controller/matchers/render_template_matcher.rb +147 -0
- data/lib/remarkable_rails/action_controller/matchers/respond_with_matcher.rb +125 -0
- data/lib/remarkable_rails/action_controller/matchers/route_matcher.rb +94 -0
- data/lib/remarkable_rails/action_controller/matchers/set_session_matcher.rb +108 -0
- data/lib/remarkable_rails/action_controller/matchers/set_the_flash_matcher.rb +55 -0
- data/lib/remarkable_rails/action_controller.rb +22 -0
- data/lib/remarkable_rails/action_view/base.rb +7 -0
- data/lib/remarkable_rails/action_view.rb +18 -0
- data/lib/remarkable_rails/active_orm.rb +19 -0
- data/lib/remarkable_rails.rb +30 -0
- data/locale/en.yml +87 -0
- data/spec/action_controller/assign_to_matcher_spec.rb +143 -0
- data/spec/action_controller/filter_params_matcher_spec.rb +64 -0
- data/spec/action_controller/macro_stubs_spec.rb +196 -0
- data/spec/action_controller/redirect_to_matcher_spec.rb +102 -0
- data/spec/action_controller/render_template_matcher_spec.rb +251 -0
- data/spec/action_controller/respond_with_matcher_spec.rb +223 -0
- data/spec/action_controller/route_matcher_spec.rb +75 -0
- data/spec/action_controller/set_session_matcher_spec.rb +135 -0
- data/spec/action_controller/set_the_flash_matcher_spec.rb +95 -0
- data/spec/application/application.rb +15 -0
- data/spec/application/examples/_example.html.erb +0 -0
- data/spec/application/examples/example.html.erb +0 -0
- data/spec/application/examples/example.xml.builder +0 -0
- data/spec/application/examples/new.html.erb +0 -0
- data/spec/application/layouts/examples.html.erb +0 -0
- data/spec/application/projects/new.html.erb +0 -0
- data/spec/application/tasks_controller.rb +34 -0
- data/spec/functional_builder.rb +93 -0
- data/spec/rcov.opts +2 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +44 -0
- metadata +134 -0
@@ -0,0 +1,251 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe 'render_template' do
|
4
|
+
include FunctionalBuilder
|
5
|
+
|
6
|
+
describe 'messages' do
|
7
|
+
before(:each) do
|
8
|
+
build_response { render :action => 'new' }
|
9
|
+
@matcher = render_template('edit')
|
10
|
+
end
|
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"'
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should set rendered? message' do
|
26
|
+
build_response
|
27
|
+
@matcher.matches?(@controller)
|
28
|
+
@matcher.failure_message.should == 'Expected template "edit" to be rendered, got no render'
|
29
|
+
@matcher.negative_failure_message.should == 'Did not expect template "edit" to be rendered, got no render'
|
30
|
+
end
|
31
|
+
|
32
|
+
# Is not possible to check extensions on Rails 2.1
|
33
|
+
unless RAILS_VERSION =~ /^2.1/
|
34
|
+
it 'should set template_matches? message' do
|
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')
|
42
|
+
@matcher.layout('users').matches?(@controller)
|
43
|
+
@matcher.failure_message.should == 'Expected to render with layout "users", got nil'
|
44
|
+
end
|
45
|
+
end
|
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
|
155
|
+
end
|
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
|
246
|
+
end
|
247
|
+
|
248
|
+
generate_macro_stubs_specs_for(:render_template, 'new')
|
249
|
+
generate_macro_stubs_specs_for(:render_with_layout, 'examples')
|
250
|
+
generate_macro_stubs_specs_for(:render_without_layout)
|
251
|
+
end
|
@@ -0,0 +1,223 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe 'respond_with' do
|
4
|
+
include FunctionalBuilder
|
5
|
+
|
6
|
+
describe 'messages' do
|
7
|
+
before(:each) do
|
8
|
+
build_response
|
9
|
+
@matcher = respond_with(:error)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should contain a description message' do
|
13
|
+
respond_with(404).description.should == 'respond with 404'
|
14
|
+
respond_with(:error).description.should == 'respond with error'
|
15
|
+
respond_with(500..599).description.should == 'respond with 500..599'
|
16
|
+
|
17
|
+
@matcher.body(/anything/)
|
18
|
+
@matcher.description.should == 'respond with error and with body /anything/'
|
19
|
+
|
20
|
+
@matcher.content_type(Mime::XML).matches?(@controller)
|
21
|
+
@matcher.description.should == 'respond with error, with body /anything/, and with content type "application/xml"'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should set status_matches? message' do
|
25
|
+
@matcher.matches?(@controller)
|
26
|
+
@matcher.failure_message.should == 'Expected to respond with :error, got 200'
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should set content_type_matches? message' do
|
30
|
+
@matcher = respond_with(:success)
|
31
|
+
@matcher.body(/anything/).matches?(@controller)
|
32
|
+
@matcher.failure_message.should == 'Expected to respond with body equals to /anything/, got " "'
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should set content_type_matches? message' do
|
36
|
+
@matcher = respond_with(:success)
|
37
|
+
@matcher.content_type(Mime::XML).matches?(@controller)
|
38
|
+
@matcher.failure_message.should == 'Expected to respond with content type "application/xml", got "text/html"'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe 'matcher' do
|
43
|
+
|
44
|
+
describe 'on success' do
|
45
|
+
before(:each){ build_response }
|
46
|
+
|
47
|
+
it { should respond_with(200) }
|
48
|
+
it { should respond_with(:ok) }
|
49
|
+
it { should respond_with(:success) }
|
50
|
+
it { should respond_with(200..299) }
|
51
|
+
|
52
|
+
it { should respond_with(200, :content_type => Mime::HTML) }
|
53
|
+
it { should respond_with(:ok, :content_type => Mime::HTML) }
|
54
|
+
it { should respond_with(:success, :content_type => Mime::HTML) }
|
55
|
+
it { should respond_with(200..299, :content_type => Mime::HTML) }
|
56
|
+
|
57
|
+
it { should_not respond_with(404) }
|
58
|
+
it { should_not respond_with(:not_found) }
|
59
|
+
it { should_not respond_with(300..400) }
|
60
|
+
end
|
61
|
+
|
62
|
+
describe 'on missing' do
|
63
|
+
before(:each){ build_response { render :text => "404 Not Found", :status => 404 } }
|
64
|
+
|
65
|
+
it { should respond_with(404) }
|
66
|
+
it { should respond_with(:not_found) }
|
67
|
+
it { should respond_with(:missing) }
|
68
|
+
it { should respond_with(400..405) }
|
69
|
+
|
70
|
+
it { should_not respond_with(302) }
|
71
|
+
it { should_not respond_with(:found) }
|
72
|
+
it { should_not respond_with(:redirect) }
|
73
|
+
it { should_not respond_with(300..305) }
|
74
|
+
end
|
75
|
+
|
76
|
+
describe 'respond_with_body' do
|
77
|
+
before(:each) { build_response { respond_to{ |format| format.xml { render :xml => [].to_xml } } } }
|
78
|
+
|
79
|
+
it { should respond_with_body(%{<?xml version="1.0" encoding="UTF-8"?>\n<nil-classes type="array"/>\n}) }
|
80
|
+
it { should respond_with_body(/xml/) }
|
81
|
+
it { should_not respond_with_body('html') }
|
82
|
+
it { should_not respond_with_body(/html/) }
|
83
|
+
end
|
84
|
+
|
85
|
+
describe 'on redirect' do
|
86
|
+
before(:each){ build_response { redirect_to project_tasks_url(1) } }
|
87
|
+
|
88
|
+
it { should respond_with(302) }
|
89
|
+
it { should respond_with(:found) }
|
90
|
+
it { should respond_with(:redirect) }
|
91
|
+
it { should respond_with(300..305) }
|
92
|
+
|
93
|
+
it { should_not respond_with(200) }
|
94
|
+
it { should_not respond_with(:ok) }
|
95
|
+
it { should_not respond_with(:success) }
|
96
|
+
it { should_not respond_with(200..299) }
|
97
|
+
end
|
98
|
+
|
99
|
+
describe 'respond_with_content_type' do
|
100
|
+
describe 'and Mime::HTML' do
|
101
|
+
before(:each){ build_response { render :action => :new } }
|
102
|
+
|
103
|
+
it { should respond_with_content_type(:html) }
|
104
|
+
it { should respond_with_content_type(/html/) }
|
105
|
+
it { should respond_with_content_type(Mime::HTML) }
|
106
|
+
it { should respond_with_content_type('text/html') }
|
107
|
+
|
108
|
+
it { should_not respond_with_content_type(:xml) }
|
109
|
+
it { should_not respond_with_content_type(/xml/) }
|
110
|
+
it { should_not respond_with_content_type(Mime::XML) }
|
111
|
+
it { should_not respond_with_content_type('application/xml') }
|
112
|
+
end
|
113
|
+
|
114
|
+
describe 'and Mime::XML' do
|
115
|
+
before(:each) { build_response { respond_to{ |format| format.xml } } }
|
116
|
+
|
117
|
+
it { should respond_with_content_type(:xml) }
|
118
|
+
it { should respond_with_content_type(/xml/) }
|
119
|
+
it { should respond_with_content_type(Mime::XML) }
|
120
|
+
it { should respond_with_content_type('application/xml') }
|
121
|
+
|
122
|
+
it { should_not respond_with_content_type(:html) }
|
123
|
+
it { should_not respond_with_content_type(/html/) }
|
124
|
+
it { should_not respond_with_content_type(Mime::HTML) }
|
125
|
+
it { should_not respond_with_content_type('text/html') }
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
describe 'macro' do
|
132
|
+
|
133
|
+
describe 'on success' do
|
134
|
+
before(:each){ build_response }
|
135
|
+
|
136
|
+
should_respond_with 200
|
137
|
+
should_respond_with :ok
|
138
|
+
should_respond_with :success
|
139
|
+
should_respond_with 200..299
|
140
|
+
|
141
|
+
should_respond_with 200, :content_type => Mime::HTML
|
142
|
+
should_respond_with :ok, :content_type => Mime::HTML
|
143
|
+
should_respond_with :success, :content_type => Mime::HTML
|
144
|
+
should_respond_with 200..299, :content_type => Mime::HTML
|
145
|
+
|
146
|
+
should_not_respond_with 404
|
147
|
+
should_not_respond_with :not_found
|
148
|
+
should_not_respond_with 300..400
|
149
|
+
end
|
150
|
+
|
151
|
+
describe 'on missing' do
|
152
|
+
before(:each){ build_response { render :text => "404 Not Found", :status => 404 } }
|
153
|
+
|
154
|
+
should_respond_with 404
|
155
|
+
should_respond_with :not_found
|
156
|
+
should_respond_with :missing
|
157
|
+
should_respond_with 400..405
|
158
|
+
|
159
|
+
should_not_respond_with 302
|
160
|
+
should_not_respond_with :found
|
161
|
+
should_not_respond_with :redirect
|
162
|
+
should_not_respond_with 300..305
|
163
|
+
end
|
164
|
+
|
165
|
+
describe 'on redirect' do
|
166
|
+
before(:each){ build_response { redirect_to project_tasks_url(1) } }
|
167
|
+
|
168
|
+
should_respond_with 302
|
169
|
+
should_respond_with :found
|
170
|
+
should_respond_with :redirect
|
171
|
+
should_respond_with 300..305
|
172
|
+
|
173
|
+
should_not_respond_with 200
|
174
|
+
should_not_respond_with :ok
|
175
|
+
should_not_respond_with :success
|
176
|
+
should_not_respond_with 200..299
|
177
|
+
end
|
178
|
+
|
179
|
+
describe 'respond_with_body' do
|
180
|
+
before(:each) { build_response { respond_to{ |format| format.xml { render :xml => [].to_xml } } } }
|
181
|
+
|
182
|
+
should_respond_with_body %{<?xml version="1.0" encoding="UTF-8"?>\n<nil-classes type="array"/>\n}
|
183
|
+
should_respond_with_body /xml/
|
184
|
+
should_not_respond_with_body 'html'
|
185
|
+
should_not_respond_with_body /html/
|
186
|
+
end
|
187
|
+
|
188
|
+
describe 'respond_with_content_type' do
|
189
|
+
describe 'and Mime::HTML' do
|
190
|
+
before(:each){ build_response { render :action => :new } }
|
191
|
+
|
192
|
+
should_respond_with_content_type :html
|
193
|
+
should_respond_with_content_type /html/
|
194
|
+
should_respond_with_content_type Mime::HTML
|
195
|
+
should_respond_with_content_type 'text/html'
|
196
|
+
|
197
|
+
should_not_respond_with_content_type :xml
|
198
|
+
should_not_respond_with_content_type /xml/
|
199
|
+
should_not_respond_with_content_type Mime::XML
|
200
|
+
should_not_respond_with_content_type 'application/xml'
|
201
|
+
end
|
202
|
+
|
203
|
+
describe 'and Mime::XML' do
|
204
|
+
before(:each) { build_response { respond_to{ |format| format.xml } } }
|
205
|
+
|
206
|
+
should_respond_with_content_type :xml
|
207
|
+
should_respond_with_content_type /xml/
|
208
|
+
should_respond_with_content_type Mime::XML
|
209
|
+
should_respond_with_content_type 'application/xml'
|
210
|
+
|
211
|
+
should_not_respond_with_content_type :html
|
212
|
+
should_not_respond_with_content_type /html/
|
213
|
+
should_not_respond_with_content_type Mime::HTML
|
214
|
+
should_not_respond_with_content_type 'text/html'
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
219
|
+
|
220
|
+
generate_macro_stubs_specs_for(:respond_with, 200)
|
221
|
+
generate_macro_stubs_specs_for(:respond_with_body, /xml/)
|
222
|
+
generate_macro_stubs_specs_for(:respond_with_content_type, Mime::HTML)
|
223
|
+
end
|