rspec-rails 2.11.4 → 2.12.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Capybara.md +2 -2
- data/Changelog.md +25 -1
- data/README.md +61 -25
- data/features/controller_specs/anonymous_controller.feature +25 -25
- data/features/controller_specs/bypass_rescue.feature +4 -4
- data/features/controller_specs/controller_spec.feature +4 -4
- data/features/controller_specs/isolation_from_views.feature +13 -13
- data/features/controller_specs/render_views.feature +11 -11
- data/features/feature_specs/feature_spec.feature +34 -0
- data/features/helper_specs/helper_spec.feature +10 -10
- data/features/mailer_specs/url_helpers.feature +7 -7
- data/features/matchers/new_record_matcher.feature +20 -7
- data/features/matchers/redirect_to_matcher.feature +6 -6
- data/features/matchers/relation_match_array.feature +8 -6
- data/features/matchers/render_template_matcher.feature +25 -4
- data/features/mocks/mock_model.feature +21 -21
- data/features/mocks/stub_model.feature +8 -8
- data/features/model_specs/errors_on.feature +25 -7
- data/features/model_specs/transactional_examples.feature +13 -13
- data/features/request_specs/request_spec.feature +8 -8
- data/features/routing_specs/be_routable_matcher.feature +10 -10
- data/features/routing_specs/named_routes.feature +3 -3
- data/features/routing_specs/route_to_matcher.feature +17 -17
- data/features/view_specs/inferred_controller_path.feature +7 -6
- data/features/view_specs/stub_template.feature +5 -5
- data/features/view_specs/view_spec.feature +50 -18
- data/lib/autotest/rails_rspec2.rb +1 -1
- data/lib/generators/rspec.rb +6 -0
- data/lib/generators/rspec/controller/templates/controller_spec.rb +2 -0
- data/lib/generators/rspec/helper/templates/helper_spec.rb +2 -0
- data/lib/generators/rspec/mailer/templates/mailer_spec.rb +2 -0
- data/lib/generators/rspec/model/templates/model_spec.rb +2 -0
- data/lib/generators/rspec/observer/templates/observer_spec.rb +2 -0
- data/lib/generators/rspec/scaffold/scaffold_generator.rb +37 -3
- data/lib/generators/rspec/scaffold/templates/controller_spec.rb +9 -7
- data/lib/generators/rspec/scaffold/templates/routing_spec.rb +2 -0
- data/lib/rspec/rails/example.rb +5 -1
- data/lib/rspec/rails/example/feature_example_group.rb +30 -0
- data/lib/rspec/rails/example/view_example_group.rb +23 -12
- data/lib/rspec/rails/extensions.rb +1 -0
- data/lib/rspec/rails/extensions/active_record/base.rb +5 -3
- data/lib/rspec/rails/extensions/active_record/proxy.rb +17 -0
- data/lib/rspec/rails/matchers/be_new_record.rb +8 -0
- data/lib/rspec/rails/tasks/rspec.rake +1 -2
- data/lib/rspec/rails/vendor/capybara.rb +2 -8
- data/lib/rspec/rails/version.rb +1 -1
- data/spec/autotest/rails_rspec2_spec.rb +4 -4
- data/spec/generators/rspec/model/model_generator_spec.rb +1 -1
- data/spec/generators/rspec/scaffold/scaffold_generator_spec.rb +8 -0
- data/spec/rspec/rails/example/feature_example_group_spec.rb +56 -0
- data/spec/rspec/rails/example/view_example_group_spec.rb +7 -1
- data/spec/rspec/rails/matchers/be_new_record_spec.rb +16 -2
- data/spec/rspec/rails/matchers/has_spec.rb +29 -0
- data/spec/rspec/rails/matchers/relation_match_array_spec.rb +18 -7
- metadata +66 -10
data/Capybara.md
CHANGED
@@ -8,7 +8,7 @@ Note that you need to require "capybara/rspec" for this integration to work.
|
|
8
8
|
## Capybara::DSL
|
9
9
|
|
10
10
|
Adds the `visit` and `page` methods, which work together to simulate a
|
11
|
-
|
11
|
+
GET request and provide access to the result (via `page`).
|
12
12
|
|
13
13
|
## Capybara::RSpecMatchers
|
14
14
|
|
@@ -50,7 +50,7 @@ Capybara::RSpecMatchers is added to examples in:
|
|
50
50
|
Many users have been confused by the co-existence of the the
|
51
51
|
Capybara::DSL (visit/page) alongside the rack-test DSL
|
52
52
|
(get|post|put|delete|head/response.body) in examples in spec/requests
|
53
|
-
and spec/controllers. As of rspec-2.11.1 and capybara-2.0.0.beta2, these
|
53
|
+
and spec/controllers. As of rspec-rails-2.11.1 and capybara-2.0.0.beta2, these
|
54
54
|
are separated as follows:
|
55
55
|
|
56
56
|
* Capybara::DSL is included `spec/features`
|
data/Changelog.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
### 2.12.0 / 2012-11-12
|
2
|
+
[full changelog](http://github.com/rspec/rspec-rails/compare/v2.11.4...2.12.0)
|
3
|
+
|
4
|
+
Enhancements
|
5
|
+
|
6
|
+
* Support validation contexts when using `#errors_on` (Woody Peterson)
|
7
|
+
* Include RequestExampleGroup in groups in spec/api
|
8
|
+
|
9
|
+
Bug fixes
|
10
|
+
|
11
|
+
* Add `should` and `should_not` to `CollectionProxy` (Rails 3.1+) and
|
12
|
+
`AssociationProxy` (Rails 3.0). (Myron Marston)
|
13
|
+
* `controller.controller_path` is set correctly for view specs in Rails 3.1+.
|
14
|
+
(Andy Lindeman)
|
15
|
+
* Generated specs support module namespacing (e.g., in a Rails engine).
|
16
|
+
(Andy Lindeman)
|
17
|
+
* `render` properly infers the view to be rendered in Rails 3.0 and 3.1
|
18
|
+
(John Firebaugh)
|
19
|
+
* AutoTest mappings involving config/ work correctly (Brent J. Nordquist)
|
20
|
+
* Failures message for `be_new_record` are more useful (Andy Lindeman)
|
21
|
+
|
1
22
|
### 2.11.4 / 2012-10-14
|
2
23
|
[full changelog](http://github.com/rspec/rspec-rails/compare/v2.11.0...v2.11.4)
|
3
24
|
|
@@ -7,7 +28,7 @@ Capybara-2.0 integration support:
|
|
7
28
|
* include Capybara::DSL and Capybara::RSpecMatchers in spec/features
|
8
29
|
|
9
30
|
See [https://github.com/jnicklas/capybara/pull/809](https://github.com/jnicklas/capybara/pull/809)
|
10
|
-
and [http://rubydoc.info/gems/rspec-rails/file/
|
31
|
+
and [http://rubydoc.info/gems/rspec-rails/file/Capybara.md](http://rubydoc.info/gems/rspec-rails/file/Capybara.md)
|
11
32
|
for background.
|
12
33
|
|
13
34
|
2.11.1, .2, .3 were yanked due to errant documentation.
|
@@ -21,6 +42,9 @@ Enhancements
|
|
21
42
|
specs run in random order by default.
|
22
43
|
* rename `render_template` to `have_rendered` (and alias to `render_template`
|
23
44
|
for backward compatibility)
|
45
|
+
* The controller spec generated with `rails generate scaffold namespaced::model`
|
46
|
+
matches the spec generated with `rails generate scaffold namespaced/model`
|
47
|
+
(Kohei Hasegawa)
|
24
48
|
|
25
49
|
Bug fixes
|
26
50
|
|
data/README.md
CHANGED
@@ -112,6 +112,7 @@ intent is to specify one or more request/response cycles from end to end using
|
|
112
112
|
a black box approach.
|
113
113
|
|
114
114
|
```ruby
|
115
|
+
require 'spec_helper'
|
115
116
|
describe "home page" do
|
116
117
|
it "displays the user's username after successful login" do
|
117
118
|
user = User.create!(:username => "jdoe", :password => "secret")
|
@@ -129,9 +130,10 @@ end
|
|
129
130
|
```
|
130
131
|
|
131
132
|
This example uses only standard Rails and RSpec API's, but many RSpec/Rails
|
132
|
-
users like to use extension libraries like FactoryGirl and Capybara:
|
133
|
+
users like to use extension libraries like [FactoryGirl](https://github.com/thoughtbot/factory_girl) and [Capybara](https://github.com/jnicklas/capybara):
|
133
134
|
|
134
135
|
```ruby
|
136
|
+
require 'spec_helper'
|
135
137
|
describe "home page" do
|
136
138
|
it "displays the user's username after successful login" do
|
137
139
|
user = FactoryGirl.create(:user, :username => "jdoe", :password => "secret")
|
@@ -140,7 +142,7 @@ describe "home page" do
|
|
140
142
|
fill_in "Password", :with => "secret"
|
141
143
|
click_button "Log in"
|
142
144
|
|
143
|
-
page.
|
145
|
+
expect(page).to have_selector(".header .username", :text => "jdoe")
|
144
146
|
end
|
145
147
|
end
|
146
148
|
```
|
@@ -167,13 +169,14 @@ tests.
|
|
167
169
|
## with fixtures
|
168
170
|
|
169
171
|
```ruby
|
172
|
+
require 'spec_helper'
|
170
173
|
describe WidgetsController do
|
171
174
|
describe "GET index" do
|
172
175
|
fixtures :widgets
|
173
176
|
|
174
177
|
it "assigns all widgets to @widgets" do
|
175
178
|
get :index
|
176
|
-
assigns(:widgets).
|
179
|
+
expect(assigns(:widgets)).to eq(Widget.all)
|
177
180
|
end
|
178
181
|
end
|
179
182
|
end
|
@@ -182,12 +185,13 @@ end
|
|
182
185
|
## with a factory
|
183
186
|
|
184
187
|
```ruby
|
188
|
+
require 'spec_helper'
|
185
189
|
describe WidgetsController do
|
186
190
|
describe "GET index" do
|
187
191
|
it "assigns all widgets to @widgets" do
|
188
192
|
widget = FactoryGirl.create(:widget)
|
189
193
|
get :index
|
190
|
-
assigns(:widgets).
|
194
|
+
expect(assigns(:widgets)).to eq([widget])
|
191
195
|
end
|
192
196
|
end
|
193
197
|
end
|
@@ -196,13 +200,14 @@ end
|
|
196
200
|
## with stubs
|
197
201
|
|
198
202
|
```ruby
|
203
|
+
require 'spec_helper'
|
199
204
|
describe WidgetsController do
|
200
205
|
describe "GET index" do
|
201
206
|
it "assigns all widgets to @widgets" do
|
202
207
|
widget = stub_model(Widget)
|
203
208
|
Widget.stub(:all) { [widget] }
|
204
209
|
get :index
|
205
|
-
assigns(:widgets).
|
210
|
+
expect(assigns(:widgets)).to eq([widget])
|
206
211
|
end
|
207
212
|
end
|
208
213
|
end
|
@@ -214,10 +219,10 @@ In addition to the stock matchers from rspec-expectations, controller
|
|
214
219
|
specs add these matchers, which delegate to rails' assertions:
|
215
220
|
|
216
221
|
```ruby
|
217
|
-
response.
|
222
|
+
expect(response).to render_template(*args)
|
218
223
|
# => delegates to assert_template(*args)
|
219
224
|
|
220
|
-
response.
|
225
|
+
expect(response).to redirect_to(destination)
|
221
226
|
# => delegates to assert_redirected_to(destination)
|
222
227
|
```
|
223
228
|
|
@@ -240,6 +245,7 @@ functional tests, you can tell controller groups to render the views in the
|
|
240
245
|
app with the `render_views` declaration:
|
241
246
|
|
242
247
|
```ruby
|
248
|
+
require 'spec_helper'
|
243
249
|
describe WidgetsController do
|
244
250
|
render_views
|
245
251
|
# ...
|
@@ -256,7 +262,7 @@ assigns to the view in the course of an action:
|
|
256
262
|
|
257
263
|
```ruby
|
258
264
|
get :index
|
259
|
-
assigns(:widgets).
|
265
|
+
expect(assigns(:widgets)).to eq(expected_value)
|
260
266
|
```
|
261
267
|
|
262
268
|
# View specs
|
@@ -264,11 +270,12 @@ assigns(:widgets).should eq(expected_value)
|
|
264
270
|
View specs live in spec/views, and mix in ActionView::TestCase::Behavior.
|
265
271
|
|
266
272
|
```ruby
|
273
|
+
require 'spec_helper'
|
267
274
|
describe "events/index" do
|
268
275
|
it "renders _event partial for each event" do
|
269
276
|
assign(:events, [stub_model(Event), stub_model(Event)])
|
270
277
|
render
|
271
|
-
view.
|
278
|
+
expect(view).to render_template(:partial => "_event", :count => 2)
|
272
279
|
end
|
273
280
|
end
|
274
281
|
|
@@ -278,7 +285,7 @@ describe "events/show" do
|
|
278
285
|
:location => "Chicago"
|
279
286
|
))
|
280
287
|
render
|
281
|
-
rendered.
|
288
|
+
expect(rendered).to include("Chicago")
|
282
289
|
end
|
283
290
|
end
|
284
291
|
```
|
@@ -344,7 +351,7 @@ This represents the rendered view.
|
|
344
351
|
|
345
352
|
```ruby
|
346
353
|
render
|
347
|
-
rendered.
|
354
|
+
expect(rendered).to match /Some text expected to appear on the page/
|
348
355
|
```
|
349
356
|
|
350
357
|
### Upgrade note
|
@@ -357,6 +364,10 @@ response.should xxx
|
|
357
364
|
# rspec-rails-2.x
|
358
365
|
render
|
359
366
|
rendered.should xxx
|
367
|
+
|
368
|
+
# rspec-rails-2.x with expect syntax
|
369
|
+
render
|
370
|
+
expect(rendered).to xxx
|
360
371
|
```
|
361
372
|
|
362
373
|
# Model specs
|
@@ -364,21 +375,22 @@ rendered.should xxx
|
|
364
375
|
Model specs live in spec/models.
|
365
376
|
|
366
377
|
```ruby
|
378
|
+
require 'spec_helper'
|
367
379
|
describe Article do
|
368
380
|
describe ".recent" do
|
369
381
|
it "includes articles published less than one week ago" do
|
370
382
|
article = Article.create!(:published_at => Date.today - 1.week + 1.second)
|
371
|
-
Article.recent.
|
383
|
+
expect(Article.recent).to eq([article])
|
372
384
|
end
|
373
385
|
|
374
386
|
it "excludes articles published at midnight one week ago" do
|
375
387
|
article = Article.create!(:published_at => Date.today - 1.week)
|
376
|
-
Article.recent.
|
388
|
+
expect(Article.recent).to be_empty
|
377
389
|
end
|
378
390
|
|
379
391
|
it "excludes articles published more than one week ago" do
|
380
392
|
article = Article.create!(:published_at => Date.today - 1.week - 1.second)
|
381
|
-
Article.recent.
|
393
|
+
expect(Article.recent).to be_empty
|
382
394
|
end
|
383
395
|
end
|
384
396
|
end
|
@@ -389,9 +401,10 @@ end
|
|
389
401
|
Routing specs live in spec/routing.
|
390
402
|
|
391
403
|
```ruby
|
404
|
+
require 'spec_helper'
|
392
405
|
describe "routing to profiles" do
|
393
406
|
it "routes /profile/:username to profile#show for username" do
|
394
|
-
|
407
|
+
expect(:get => "/profiles/jsmith").to route_to(
|
395
408
|
:controller => "profiles",
|
396
409
|
:action => "show",
|
397
410
|
:username => "jsmith"
|
@@ -399,7 +412,7 @@ describe "routing to profiles" do
|
|
399
412
|
end
|
400
413
|
|
401
414
|
it "does not expose a list of profiles" do
|
402
|
-
|
415
|
+
expect(:get => "/profiles").not_to be_routable
|
403
416
|
end
|
404
417
|
end
|
405
418
|
```
|
@@ -416,13 +429,14 @@ Provides a `helper` object which mixes in the helper module being spec'd, along
|
|
416
429
|
with `ApplicationHelper` (if present).
|
417
430
|
|
418
431
|
```ruby
|
432
|
+
require 'spec_helper'
|
419
433
|
describe EventsHelper do
|
420
434
|
describe "#link_to_event" do
|
421
435
|
it "displays the title, and formatted date" do
|
422
436
|
event = Event.new("Ruby Kaigi", Date.new(2010, 8, 27))
|
423
437
|
# helper is an instance of ActionView::Base configured with the
|
424
438
|
# EventsHelper and all of Rails' built-in helpers
|
425
|
-
helper.link_to_event.
|
439
|
+
expect(helper.link_to_event).to match /Ruby Kaigi, 27 Aug, 2010/
|
426
440
|
end
|
427
441
|
end
|
428
442
|
end
|
@@ -438,7 +452,7 @@ of them simply delegate to Rails' assertions.
|
|
438
452
|
* Primarily intended for controller specs
|
439
453
|
|
440
454
|
```ruby
|
441
|
-
object.
|
455
|
+
expect(object).to be_a_new(Widget)
|
442
456
|
```
|
443
457
|
|
444
458
|
|
@@ -451,13 +465,13 @@ Passes if the object is a `Widget` and returns true for `new_record?`
|
|
451
465
|
In request and controller specs, apply to the response object:
|
452
466
|
|
453
467
|
```ruby
|
454
|
-
response.
|
468
|
+
expect(response).to render_template("new")
|
455
469
|
```
|
456
470
|
|
457
471
|
In view specs, apply to the view object:
|
458
472
|
|
459
473
|
```ruby
|
460
|
-
view.
|
474
|
+
expect(view).to render_template(:partial => "_form", :locals => { :widget => widget } )
|
461
475
|
```
|
462
476
|
|
463
477
|
## `redirect_to`
|
@@ -465,7 +479,7 @@ view.should render_template(:partial => "_form", :locals => { :widget => widget
|
|
465
479
|
* Available in request and controller specs.
|
466
480
|
|
467
481
|
```ruby
|
468
|
-
response.
|
482
|
+
expect(response).to redirect_to(widgets_path)
|
469
483
|
```
|
470
484
|
|
471
485
|
## `route_to`
|
@@ -474,21 +488,43 @@ response.should redirect_to(widgets_path)
|
|
474
488
|
* Available in routing and controller specs.
|
475
489
|
|
476
490
|
```ruby
|
477
|
-
|
491
|
+
expect(:get => "/widgets").to route_to(:controller => "widgets", :action => "index")
|
478
492
|
```
|
479
493
|
|
480
494
|
## `be_routable`
|
481
495
|
|
482
496
|
Passes if the path is recognized by Rails' routing. This is primarily intended
|
483
|
-
to be used with `
|
497
|
+
to be used with `not_to` to specify routes that should not be routable.
|
484
498
|
|
485
499
|
```ruby
|
486
|
-
|
500
|
+
expect(:get => "/widgets/1/edit").not_to be_routable
|
501
|
+
```
|
502
|
+
|
503
|
+
# `rake` tasks
|
504
|
+
|
505
|
+
`rspec-rails` defines rake tasks to run the entire test suite (`rake spec`)
|
506
|
+
and subsets of tests (e.g., `rake spec:models`).
|
507
|
+
|
508
|
+
A full list of the available rake tasks can be seen by running `rake -T | grep
|
509
|
+
rspec`.
|
510
|
+
|
511
|
+
## Customizing `rake` tasks
|
512
|
+
|
513
|
+
If you want to customize the behavior of `rake spec`, you may [define your own
|
514
|
+
task in the `Rakefile` for your
|
515
|
+
project](https://www.relishapp.com/rspec/rspec-core/docs/command-line/rake-task).
|
516
|
+
However, you must first clear the task that rspec-rails defined:
|
517
|
+
|
518
|
+
```ruby
|
519
|
+
task("spec").clear
|
487
520
|
```
|
488
521
|
|
489
522
|
# Contribute
|
490
523
|
|
491
|
-
See [http://github.com/rspec/rspec-dev](http://github.com/rspec/rspec-dev)
|
524
|
+
See [http://github.com/rspec/rspec-dev](http://github.com/rspec/rspec-dev).
|
525
|
+
|
526
|
+
For `rspec-rails`-specific development information, see
|
527
|
+
[DEV-README](https://github.com/rspec/rspec-rails/blob/master/DEV-README.md).
|
492
528
|
|
493
529
|
# Also see
|
494
530
|
|
@@ -21,7 +21,7 @@ Feature: anonymous controller
|
|
21
21
|
|
22
22
|
Scenario: specify error handling in ApplicationController
|
23
23
|
Given a file named "spec/controllers/application_controller_spec.rb" with:
|
24
|
-
"""
|
24
|
+
"""ruby
|
25
25
|
require "spec_helper"
|
26
26
|
|
27
27
|
class ApplicationController < ActionController::Base
|
@@ -46,7 +46,7 @@ Feature: anonymous controller
|
|
46
46
|
describe "handling AccessDenied exceptions" do
|
47
47
|
it "redirects to the /401.html page" do
|
48
48
|
get :index
|
49
|
-
response.
|
49
|
+
expect(response).to redirect_to("/401.html")
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
@@ -56,7 +56,7 @@ Feature: anonymous controller
|
|
56
56
|
|
57
57
|
Scenario: specify error handling in subclass of ApplicationController
|
58
58
|
Given a file named "spec/controllers/application_controller_subclass_spec.rb" with:
|
59
|
-
"""
|
59
|
+
"""ruby
|
60
60
|
require "spec_helper"
|
61
61
|
|
62
62
|
class ApplicationController < ActionController::Base
|
@@ -84,7 +84,7 @@ Feature: anonymous controller
|
|
84
84
|
describe "handling AccessDenied exceptions" do
|
85
85
|
it "redirects to the /401.html page" do
|
86
86
|
get :index
|
87
|
-
response.
|
87
|
+
expect(response).to redirect_to("/401.html")
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
@@ -94,7 +94,7 @@ Feature: anonymous controller
|
|
94
94
|
|
95
95
|
Scenario: infer base class from the described class
|
96
96
|
Given a file named "spec/controllers/base_class_can_be_inferred_spec.rb" with:
|
97
|
-
"""
|
97
|
+
"""ruby
|
98
98
|
require "spec_helper"
|
99
99
|
|
100
100
|
RSpec.configure do |c|
|
@@ -113,7 +113,7 @@ Feature: anonymous controller
|
|
113
113
|
end
|
114
114
|
|
115
115
|
it "creates an anonymous controller derived from ApplicationControllerSubclass" do
|
116
|
-
controller.
|
116
|
+
expect(controller).to be_a_kind_of(ApplicationControllerSubclass)
|
117
117
|
end
|
118
118
|
end
|
119
119
|
"""
|
@@ -122,7 +122,7 @@ Feature: anonymous controller
|
|
122
122
|
|
123
123
|
Scenario: invoke around filter in base class
|
124
124
|
Given a file named "spec/controllers/application_controller_around_filter_spec.rb" with:
|
125
|
-
"""
|
125
|
+
"""ruby
|
126
126
|
require "spec_helper"
|
127
127
|
|
128
128
|
class ApplicationController < ActionController::Base
|
@@ -144,7 +144,7 @@ Feature: anonymous controller
|
|
144
144
|
it "invokes the callback" do
|
145
145
|
get :index
|
146
146
|
|
147
|
-
assigns[:callback_invoked].
|
147
|
+
expect(assigns[:callback_invoked]).to be_true
|
148
148
|
end
|
149
149
|
end
|
150
150
|
"""
|
@@ -153,7 +153,7 @@ Feature: anonymous controller
|
|
153
153
|
|
154
154
|
Scenario: anonymous controllers only create resource routes
|
155
155
|
Given a file named "spec/controllers/application_controller_spec.rb" with:
|
156
|
-
"""
|
156
|
+
"""ruby
|
157
157
|
require "spec_helper"
|
158
158
|
|
159
159
|
describe ApplicationController do
|
@@ -194,36 +194,36 @@ Feature: anonymous controller
|
|
194
194
|
describe "#index" do
|
195
195
|
it "responds to GET" do
|
196
196
|
get :index
|
197
|
-
response.body.
|
197
|
+
expect(response.body).to eq "index called"
|
198
198
|
end
|
199
199
|
|
200
200
|
it "also responds to POST" do
|
201
201
|
post :index
|
202
|
-
response.body.
|
202
|
+
expect(response.body).to eq "index called"
|
203
203
|
end
|
204
204
|
|
205
205
|
it "also responds to PUT" do
|
206
206
|
put :index
|
207
|
-
response.body.
|
207
|
+
expect(response.body).to eq "index called"
|
208
208
|
end
|
209
209
|
|
210
210
|
it "also responds to DELETE" do
|
211
211
|
delete :index
|
212
|
-
response.body.
|
212
|
+
expect(response.body).to eq "index called"
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
216
216
|
describe "#create" do
|
217
217
|
it "responds to POST" do
|
218
218
|
post :create
|
219
|
-
response.body.
|
219
|
+
expect(response.body).to eq "create called"
|
220
220
|
end
|
221
221
|
|
222
222
|
# And the rest...
|
223
223
|
%w{get post put delete}.each do |calltype|
|
224
224
|
it "responds to #{calltype}" do
|
225
225
|
send(calltype, :create)
|
226
|
-
response.body.
|
226
|
+
expect(response.body).to eq "create called"
|
227
227
|
end
|
228
228
|
end
|
229
229
|
end
|
@@ -231,14 +231,14 @@ Feature: anonymous controller
|
|
231
231
|
describe "#new" do
|
232
232
|
it "responds to GET" do
|
233
233
|
get :new
|
234
|
-
response.body.
|
234
|
+
expect(response.body).to eq "new called"
|
235
235
|
end
|
236
236
|
|
237
237
|
# And the rest...
|
238
238
|
%w{get post put delete}.each do |calltype|
|
239
239
|
it "responds to #{calltype}" do
|
240
240
|
send(calltype, :new)
|
241
|
-
response.body.
|
241
|
+
expect(response.body).to eq "new called"
|
242
242
|
end
|
243
243
|
end
|
244
244
|
end
|
@@ -246,7 +246,7 @@ Feature: anonymous controller
|
|
246
246
|
describe "#edit" do
|
247
247
|
it "responds to GET" do
|
248
248
|
get :edit, :id => "anyid"
|
249
|
-
response.body.
|
249
|
+
expect(response.body).to eq "edit called"
|
250
250
|
end
|
251
251
|
|
252
252
|
it "requires the :id parameter" do
|
@@ -257,7 +257,7 @@ Feature: anonymous controller
|
|
257
257
|
%w{get post put delete}.each do |calltype|
|
258
258
|
it "responds to #{calltype}" do
|
259
259
|
send(calltype, :edit, {:id => "anyid"})
|
260
|
-
response.body.
|
260
|
+
expect(response.body).to eq "edit called"
|
261
261
|
end
|
262
262
|
end
|
263
263
|
end
|
@@ -265,7 +265,7 @@ Feature: anonymous controller
|
|
265
265
|
describe "#show" do
|
266
266
|
it "responds to GET" do
|
267
267
|
get :show, :id => "anyid"
|
268
|
-
response.body.
|
268
|
+
expect(response.body).to eq "show called"
|
269
269
|
end
|
270
270
|
|
271
271
|
it "requires the :id parameter" do
|
@@ -276,7 +276,7 @@ Feature: anonymous controller
|
|
276
276
|
%w{get post put delete}.each do |calltype|
|
277
277
|
it "responds to #{calltype}" do
|
278
278
|
send(calltype, :show, {:id => "anyid"})
|
279
|
-
response.body.
|
279
|
+
expect(response.body).to eq "show called"
|
280
280
|
end
|
281
281
|
end
|
282
282
|
end
|
@@ -284,7 +284,7 @@ Feature: anonymous controller
|
|
284
284
|
describe "#update" do
|
285
285
|
it "responds to PUT" do
|
286
286
|
put :update, :id => "anyid"
|
287
|
-
response.body.
|
287
|
+
expect(response.body).to eq "update called"
|
288
288
|
end
|
289
289
|
|
290
290
|
it "requires the :id parameter" do
|
@@ -295,7 +295,7 @@ Feature: anonymous controller
|
|
295
295
|
%w{get post put delete}.each do |calltype|
|
296
296
|
it "responds to #{calltype}" do
|
297
297
|
send(calltype, :update, {:id => "anyid"})
|
298
|
-
response.body.
|
298
|
+
expect(response.body).to eq "update called"
|
299
299
|
end
|
300
300
|
end
|
301
301
|
end
|
@@ -303,7 +303,7 @@ Feature: anonymous controller
|
|
303
303
|
describe "#destroy" do
|
304
304
|
it "responds to DELETE" do
|
305
305
|
delete :destroy, :id => "anyid"
|
306
|
-
response.body.
|
306
|
+
expect(response.body).to eq "destroy called"
|
307
307
|
end
|
308
308
|
|
309
309
|
it "requires the :id parameter" do
|
@@ -314,7 +314,7 @@ Feature: anonymous controller
|
|
314
314
|
%w{get post put delete}.each do |calltype|
|
315
315
|
it "responds to #{calltype}" do
|
316
316
|
send(calltype, :destroy, {:id => "anyid"})
|
317
|
-
response.body.
|
317
|
+
expect(response.body).to eq "destroy called"
|
318
318
|
end
|
319
319
|
end
|
320
320
|
end
|