rspec-rails 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NmI5YmM2MDE1ZWZhNDVjMTgxMTZhMDhmZTJjYzVjOWFiMDVjM2I2YQ==
5
- data.tar.gz: !binary |-
6
- ZDRjOTk1Yzc4OGU1MTE0NmEzMTFiMTViZWEyODFkNGU3Y2RlNDY5ZA==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- YWM1YWQzOGEwMDI3YjdjZWEyNGU0ZGYxMmZiZDAxMWViNmJlYWI1NDE1N2I0
10
- OWY1YThiYjFkZDYwMzg5ZmJjNTVmZGMxNjVkZjFjMGIzYTY1NWQ3MzdjNzIx
11
- YmE0Y2UzYTE5Y2JhZjkwNGE3ZjZjNzFlNWQ0ZGJjMTQ5NTIzNWY=
12
- data.tar.gz: !binary |-
13
- YjVmZWE0MTVmN2Y2YjY3ZmE4Yjc4YWQyMWZlNDViNmU5YTFlODhhNDUwYTQw
14
- NDJjNGM1MzllMmMyMjYyZDZkZmEyOWU2MTYzZGMyMDMxNDZkNDAxYWZlMmQx
15
- ZDk4OTkzOTY3ODkzNjYwOWEzMzE1NTliMGEwMTYyNjM1MWRkMjM=
2
+ SHA1:
3
+ metadata.gz: 531ee4388e3473684c081da49e38e0254cc1503a
4
+ data.tar.gz: a24b272abedc01e713c31c991473bf8b290dec87
5
+ SHA512:
6
+ metadata.gz: 626e65139ca363cff2f5c770cd2eee8d2b4c45923a9f06ca56bf25010b55fba93f6d650a5c4092549dbef17943230e65e2aeb60b8c250ce9b2da77febb9c0fc2
7
+ data.tar.gz: 50b67c8d265abe9a766d50df2d0780febd6910f9ff3aef9a74aed19de6ae37c6a0ceee306851c2ca5129c1ae355e44e72283db60959bd2e4481e6a31d6786ba6
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,9 +1,18 @@
1
+ ### 3.0.2 / 2014-07-21
2
+ [Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.0.1...v3.0.2)
3
+
4
+ Bug Fixes:
5
+
6
+ * Suppress warning in `SetupAndTeardownAdapter`. (André Arko, #1085)
7
+ * Remove dependency on Rubygems. (Andre Arko & Doc Riteze, #1099)
8
+ * Standardize controller spec template style. (Thomas Kriechbaumer, #1122)
9
+
1
10
  ### 3.0.1 / 2014-06-02
2
11
  [Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.0.0...v3.0.1)
3
12
 
4
13
  Bug Fixes:
5
14
 
6
- * Fix missing require in `rails g rspec:install`. (Sam Phippen)
15
+ * Fix missing require in `rails g rspec:install`. (Sam Phippen, #1058)
7
16
 
8
17
  ### 3.0.0 / 2014-06-01
9
18
  [Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.0.0.rc1...v3.0.0)
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- # rspec-rails [![Build Status](https://secure.travis-ci.org/rspec/rspec-rails.png?branch=master)](http://travis-ci.org/rspec/rspec-rails) [![Code Climate](https://codeclimate.com/github/rspec/rspec-rails.png)](https://codeclimate.com/github/rspec/rspec-rails) [![Inline docs](http://inch-pages.github.io/github/rspec/rspec-rails.png)](http://inch-pages.github.io/github/rspec/rspec-rails)
2
-
1
+ # rspec-rails [![Build Status](https://secure.travis-ci.org/rspec/rspec-rails.png?branch=master)](http://travis-ci.org/rspec/rspec-rails) [![Code Climate](https://codeclimate.com/github/rspec/rspec-rails.png)](https://codeclimate.com/github/rspec/rspec-rails)
3
2
  **rspec-rails** is a testing framework for Rails 3.x and 4.x.
4
3
 
5
4
  Use **[rspec-rails 1.x](http://github.com/dchelimsky/rspec-rails)** for Rails
@@ -28,14 +27,27 @@ Initialize the `spec/` directory (where specs will reside) with:
28
27
  rails generate rspec:install
29
28
  ```
30
29
 
31
- This adds `spec/spec_helper.rb` and `.rspec` files that are used for
32
- configuration. See those files for more information.
30
+ This adds the following files which are used for configuration:
31
+
32
+ - `.rspec`
33
+ - `spec/spec_helper.rb`
34
+ - `spec/rails_helper.rb`
35
+
36
+ Check the comments in each file for more information.
33
37
 
34
- To run your specs, use the `rspec` command:
38
+ Use the `rspec` command to run your specs:
35
39
 
36
40
  ```
37
41
  bundle exec rspec
42
+ ```
43
+
44
+ By default the above will run all `_spec.rb` files in the `spec` directory. For
45
+ more details about this see the [RSpec spec file
46
+ docs](https://www.relishapp.com/rspec/rspec-core/docs/spec-files).
38
47
 
48
+ To run only a subset of these specs use the following command:
49
+
50
+ ```
39
51
  # Run only model specs
40
52
  bundle exec rspec spec/models
41
53
 
@@ -53,6 +65,26 @@ be run via `bin/rspec`:
53
65
  bundle binstubs rspec-core
54
66
  ```
55
67
 
68
+ ### Upgrade Note
69
+
70
+ For detailed information on the general RSpec 3.x upgrade process see the
71
+ [RSpec Upgrade docs](https://relishapp.com/rspec/docs/upgrade).
72
+
73
+ There are three particular `rspec-rails` specific changes to be aware of:
74
+
75
+ 1. [The default helper files created in RSpec 3.x have changed](https://www.relishapp.com/rspec/rspec-rails/docs/upgrade#default-helper-files)
76
+ 2. [File-type inference disabled by default](https://www.relishapp.com/rspec/rspec-rails/docs/upgrade#file-type-inference-disabled)
77
+ 3. [Rails 4.x `ActiveRecord::Migration` pending migration checks](https://www.relishapp.com/rspec/rspec-rails/docs/upgrade#pending-migration-checks)
78
+ 4. Extraction of `stub_model` and `mock_model` to
79
+ [`rspec-activemodel-mocks`](https://github.com/rspec/rspec-activemodel-mocks)
80
+
81
+ Please see the [RSpec Rails Upgrade
82
+ docs](https://www.relishapp.com/rspec/rspec-rails/docs/upgrade) for full
83
+ details.
84
+
85
+ **NOTE:** Generators run in RSpec 3.x will now require `rails_helper` instead
86
+ of `spec_helper`.
87
+
56
88
  ### Generators
57
89
 
58
90
  Once installed, RSpec will generate spec files instead of Test::Unit test files
@@ -66,13 +98,19 @@ generators](https://www.relishapp.com/rspec/rspec-rails/docs/generators).
66
98
 
67
99
  ## Model Specs
68
100
 
69
- Model specs reside in the `spec/models` folder. Use model specs to describe
70
- behavior of models (usually ActiveRecord-based) in the application. For example:
101
+ Use model specs to describe behavior of models (usually ActiveRecord-based) in
102
+ the application.
103
+
104
+ Model specs default to residing in the `spec/models` folder. Tagging any
105
+ context with the metadata `:type => :model` treats it's examples as model
106
+ specs.
107
+
108
+ For example:
71
109
 
72
110
  ```ruby
73
- require "spec_helper"
111
+ require "rails_helper"
74
112
 
75
- describe User do
113
+ RSpec.describe User, :type => :model do
76
114
  it "orders by last name" do
77
115
  lindeman = User.create!(first_name: "Andy", last_name: "Lindeman")
78
116
  chelimsky = User.create!(first_name: "David", last_name: "Chelimsky")
@@ -87,18 +125,23 @@ specs](https://www.relishapp.com/rspec/rspec-rails/docs/model-specs).
87
125
 
88
126
  ## Controller Specs
89
127
 
90
- Controller specs reside in the `spec/controllers` folder. Use controller specs
91
- to describe behavior of Rails controllers. For example:
128
+ Use controller specs to describe behavior of Rails controllers.
129
+
130
+ Controller specs default to residing in the `spec/controllers` folder. Tagging
131
+ any context with the metadata `:type => :controller` treats it's examples as
132
+ controller specs.
133
+
134
+ For example:
92
135
 
93
136
  ```ruby
94
- require "spec_helper"
137
+ require "rails_helper"
95
138
 
96
- describe PostsController do
139
+ RSpec.describe PostsController, :type => :controller do
97
140
  describe "GET #index" do
98
141
  it "responds successfully with an HTTP 200 status code" do
99
142
  get :index
100
143
  expect(response).to be_success
101
- expect(response.status).to eq(200)
144
+ expect(response).to have_http_status(200)
102
145
  end
103
146
 
104
147
  it "renders the index template" do
@@ -120,26 +163,31 @@ For more information, see [cucumber scenarios for controller
120
163
  specs](https://www.relishapp.com/rspec/rspec-rails/docs/controller-specs).
121
164
 
122
165
  **Note:** To encourage more isolated testing, views are not rendered by default
123
- in controller specs. If you are verifying discrete view logic, use a
124
- [view spec](#view-specs). If you are verifying the behaviour of a controller and
125
- view together, consider a [request spec](#request-specs). You can use
166
+ in controller specs. If you are verifying discrete view logic, use a [view
167
+ spec](#view-specs). If you are verifying the behaviour of a controller and view
168
+ together, consider a [request spec](#request-specs). You can use
126
169
  [render\_views](https://www.relishapp.com/rspec/rspec-rails/docs/controller-specs/render-views)
127
- if you must verify the rendered view contents within a controller spec, but this is
128
- not recommended.
170
+ if you must verify the rendered view contents within a controller spec, but
171
+ this is not recommended.
129
172
 
130
- ## <a id="request-spec"></a>Request Specs
173
+ ## Request Specs
131
174
 
132
- Request specs live in spec/requests, spec/api and
133
- spec/integration, and mix in behavior
175
+ Use request specs to specify one or more request/response cycles from end to
176
+ end using a black box approach.
177
+
178
+ Request specs default to residing in the `spec/requests`, `spec/api`, and
179
+ `spec/integration` directories. Tagging any context with the metadata `:type =>
180
+ :request` treats it's examples as request specs.
181
+
182
+ Request specs mix in behavior from
134
183
  [ActionDispatch::Integration::Runner](http://api.rubyonrails.org/classes/ActionDispatch/Integration/Runner.html),
135
184
  which is the basis for [Rails' integration
136
- tests](http://guides.rubyonrails.org/testing.html#integration-testing). The
137
- intent is to specify one or more request/response cycles from end to end using
138
- a black box approach.
185
+ tests](http://guides.rubyonrails.org/testing.html#integration-testing).
139
186
 
140
187
  ```ruby
141
- require 'spec_helper'
142
- describe "home page" do
188
+ require 'rails_helper'
189
+
190
+ RSpec.describe "home page", :type => :request do
143
191
  it "displays the user's username after successful login" do
144
192
  user = User.create!(:username => "jdoe", :password => "secret")
145
193
  get "/login"
@@ -155,14 +203,15 @@ describe "home page" do
155
203
  end
156
204
  ```
157
205
 
158
- This example uses only standard Rails and RSpec API's, but many RSpec/Rails
159
- users like to use extension libraries like
206
+ The above example uses only standard Rails and RSpec API's, but many
207
+ RSpec/Rails users like to use extension libraries like
160
208
  [FactoryGirl](https://github.com/thoughtbot/factory_girl) and
161
209
  [Capybara](https://github.com/jnicklas/capybara):
162
210
 
163
211
  ```ruby
164
- require 'spec_helper'
165
- describe "home page" do
212
+ require 'rails_helper'
213
+
214
+ RSpec.describe "home page", :type => :request do
166
215
  it "displays the user's username after successful login" do
167
216
  user = FactoryGirl.create(:user, :username => "jdoe", :password => "secret")
168
217
  visit "/login"
@@ -180,7 +229,7 @@ which can be encoded into the underlying factory definition without requiring
180
229
  changes to this example.
181
230
 
182
231
  Among other benefits, Capybara binds the form post to the generated HTML, which
183
- means we don't need to specify them separately. Note that Capybara's DSL as
232
+ means we don't need to specify them separately. Note that Capybara's DSL as
184
233
  shown is, by default, only available in specs in the spec/features directory.
185
234
  For more information, see the [Capybara integration
186
235
  docs](http://rubydoc.info/gems/rspec-rails/file/Capybara.md).
@@ -191,15 +240,18 @@ FactoryGirl and Capybara seem to be the most widely used. Whether you choose
191
240
  these or other libs, we strongly recommend using something for each of these
192
241
  roles.
193
242
 
194
- ## <a id="feature-specs"></a>Feature Specs
195
-
196
- Feature specs live in spec/features, and mix in functionality from the
197
- capybara gem.
243
+ ## Feature Specs
198
244
 
199
245
  Feature specs test your application from the outside by simulating a browser.
200
- capybara is used to manage the simulated browser.
246
+ [`capybara`](https://github.com/jnicklas/capybara) is used to manage the
247
+ simulated browser.
248
+
249
+ Feature specs default to residing in the `spec/features` folder. Tagging any
250
+ context with the metadata `:type => :feature` treats it's examples as feature
251
+ specs.
201
252
 
202
- To use feature specs, add `capybara` to `Gemfile`:
253
+ Feature specs mix in functionality from the capybara gem, thus they require
254
+ `capybara` to use. To use feature specs, add `capybara` to the `Gemfile`:
203
255
 
204
256
  ```ruby
205
257
  gem "capybara"
@@ -210,23 +262,25 @@ specs](https://www.relishapp.com/rspec/rspec-rails/v/3-0/docs/feature-specs/feat
210
262
 
211
263
  ## View specs
212
264
 
213
- View specs live in spec/views, and mix in ActionView::TestCase::Behavior.
265
+ View specs default to residing in the `spec/views` folder. Tagging any context
266
+ with the metadata `:type => :view` treats it's examples as view specs.
267
+
268
+ View specs mix in `ActionView::TestCase::Behavior`.
214
269
 
215
270
  ```ruby
216
- require 'spec_helper'
217
- describe "events/index" do
271
+ require 'rails_helper'
272
+
273
+ RSpec.describe "events/index", :type => :view do
218
274
  it "renders _event partial for each event" do
219
- assign(:events, [stub_model(Event), stub_model(Event)])
275
+ assign(:events, [double(Event), double(Event)])
220
276
  render
221
277
  expect(view).to render_template(:partial => "_event", :count => 2)
222
278
  end
223
279
  end
224
280
 
225
- describe "events/show" do
281
+ RSpec.describe "events/show", :type => :view do
226
282
  it "displays the event location" do
227
- assign(:event, stub_model(Event,
228
- :location => "Chicago"
229
- ))
283
+ assign(:event, Event.new(:location => "Chicago"))
230
284
  render
231
285
  expect(rendered).to include("Chicago")
232
286
  end
@@ -234,7 +288,7 @@ end
234
288
  ```
235
289
 
236
290
  View specs infer the controller name and path from the path to the view
237
- template. e.g. if the template is "events/index.html.erb" then:
291
+ template. e.g. if the template is `events/index.html.erb` then:
238
292
 
239
293
  ```ruby
240
294
  controller.controller_path == "events"
@@ -246,23 +300,23 @@ spec'ing a partial that is included across different controllers, you _may_
246
300
  need to override these values before rendering the view.
247
301
 
248
302
  To provide a layout for the render, you'll need to specify _both_ the template
249
- and the layout explicitly. For example:
303
+ and the layout explicitly. For example:
250
304
 
251
305
  ```ruby
252
306
  render :template => "events/show", :layout => "layouts/application"
253
307
  ```
254
308
 
255
- ## `assign(key, val)`
309
+ ### `assign(key, val)`
256
310
 
257
311
  Use this to assign values to instance variables in the view:
258
312
 
259
313
  ```ruby
260
- assign(:widget, stub_model(Widget))
314
+ assign(:widget, Widget.new)
261
315
  render
262
316
  ```
263
317
 
264
- The code above assigns `stub_model(Widget)` to the `@widget` variable in the view, and then
265
- renders the view.
318
+ The code above assigns `Widget.new` to the `@widget` variable in the view, and
319
+ then renders the view.
266
320
 
267
321
  Note that because view specs mix in `ActionView::TestCase` behavior, any
268
322
  instance variables you set will be transparently propagated into your views
@@ -270,7 +324,7 @@ instance variables you set will be transparently propagated into your views
270
324
  available in views). For example:
271
325
 
272
326
  ```ruby
273
- @widget = stub_model(Widget)
327
+ @widget = Widget.new
274
328
  render # @widget is available inside the view
275
329
  ```
276
330
 
@@ -278,17 +332,17 @@ RSpec doesn't officially support this pattern, which only works as a
278
332
  side-effect of the inclusion of `ActionView::TestCase`. Be aware that it may be
279
333
  made unavailable in the future.
280
334
 
281
- ### Upgrade note
335
+ #### Upgrade note
282
336
 
283
337
  ```ruby
284
338
  # rspec-rails-1.x
285
339
  assigns[key] = value
286
340
 
287
- # rspec-rails-2.x
341
+ # rspec-rails-2.x+
288
342
  assign(key, value)
289
343
  ```
290
344
 
291
- ## `rendered`
345
+ ### `rendered`
292
346
 
293
347
  This represents the rendered view.
294
348
 
@@ -297,29 +351,32 @@ render
297
351
  expect(rendered).to match /Some text expected to appear on the page/
298
352
  ```
299
353
 
300
- ### Upgrade note
354
+ #### Upgrade note
301
355
 
302
356
  ```ruby
303
357
  # rspec-rails-1.x
304
358
  render
305
359
  response.should xxx
306
360
 
307
- # rspec-rails-2.x
361
+ # rspec-rails-2.x+
308
362
  render
309
363
  rendered.should xxx
310
364
 
311
- # rspec-rails-2.x with expect syntax
365
+ # rspec-rails-2.x+ with expect syntax
312
366
  render
313
367
  expect(rendered).to xxx
314
368
  ```
315
369
 
316
- # Routing specs
370
+ ## Routing specs
317
371
 
318
- Routing specs live in spec/routing.
372
+ Routing specs default to residing in the `spec/routing` folder. Tagging any
373
+ context with the metadata `:type => :routing` treats it's examples as routing
374
+ specs.
319
375
 
320
376
  ```ruby
321
- require 'spec_helper'
322
- describe "routing to profiles" do
377
+ require 'rails_helper'
378
+
379
+ RSpec.describe "routing to profiles", :type => :routing do
323
380
  it "routes /profile/:username to profile#show for username" do
324
381
  expect(:get => "/profiles/jsmith").to route_to(
325
382
  :controller => "profiles",
@@ -336,18 +393,23 @@ end
336
393
 
337
394
  ### Upgrade note
338
395
 
339
- `route_for` from rspec-rails-1.x is gone. Use `route_to` and `be_routable` instead.
396
+ `route_for` from rspec-rails-1.x is gone. Use `route_to` and `be_routable`
397
+ instead.
340
398
 
341
- # Helper specs
399
+ ## Helper specs
342
400
 
343
- Helper specs live in spec/helpers, and mix in ActionView::TestCase::Behavior.
401
+ Helper specs default to residing in the `spec/helpers` folder. Tagging any
402
+ context with the metadata `:type => :helper` treats it's examples as helper
403
+ specs.
344
404
 
345
- Provides a `helper` object which mixes in the helper module being spec'd, along
346
- with `ApplicationHelper` (if present).
405
+ Helper specs mix in ActionView::TestCase::Behavior. A `helper` object is
406
+ provided which mixes in the helper module being spec'd, along with
407
+ `ApplicationHelper` (if present).
347
408
 
348
409
  ```ruby
349
- require 'spec_helper'
350
- describe EventsHelper do
410
+ require 'rails_helper'
411
+
412
+ RSpec.describe EventsHelper, :type => :helper do
351
413
  describe "#link_to_event" do
352
414
  it "displays the title, and formatted date" do
353
415
  event = Event.new("Ruby Kaigi", Date.new(2010, 8, 27))
@@ -359,75 +421,78 @@ describe EventsHelper do
359
421
  end
360
422
  ```
361
423
 
362
- # Matchers
424
+ ## Matchers
363
425
 
364
- rspec-rails exposes domain-specific matchers to each of the example group types. Most
365
- of them simply delegate to Rails' assertions.
426
+ Several domain-specific matchers are provided to each of the example group
427
+ types. Most simply delegate to their equivalent Rails' assertions.
366
428
 
367
- ## `be_a_new`
368
- * Available in all specs.
369
- * Primarily intended for controller specs
429
+ ### `be_a_new`
430
+
431
+ - Available in all specs
432
+ - Primarily intended for controller specs
370
433
 
371
434
  ```ruby
372
435
  expect(object).to be_a_new(Widget)
373
436
  ```
374
437
 
375
-
376
438
  Passes if the object is a `Widget` and returns true for `new_record?`
377
439
 
378
- ## `render_template`
379
- * Delegates to Rails' assert_template.
380
- * Available in request, controller, and view specs.
440
+ ### `render_template`
381
441
 
382
- In request and controller specs, apply to the response object:
442
+ - Delegates to Rails' `assert_template`
443
+ - Available in request, controller, and view specs
444
+
445
+ In request and controller specs, apply to the `response` object:
383
446
 
384
447
  ```ruby
385
448
  expect(response).to render_template("new")
386
449
  ```
387
450
 
388
- In view specs, apply to the view object:
451
+ In view specs, apply to the `view` object:
389
452
 
390
453
  ```ruby
391
454
  expect(view).to render_template(:partial => "_form", :locals => { :widget => widget } )
392
455
  ```
393
456
 
394
- ## `redirect_to`
395
- * Delegates to assert_redirect
396
- * Available in request and controller specs.
457
+ ### `redirect_to`
458
+
459
+ - Delegates to `assert_redirect`
460
+ - Available in request and controller specs
397
461
 
398
462
  ```ruby
399
463
  expect(response).to redirect_to(widgets_path)
400
464
  ```
401
465
 
402
- ## `route_to`
466
+ ### `route_to`
403
467
 
404
- * Delegates to Rails' assert_routing.
405
- * Available in routing and controller specs.
468
+ - Delegates to Rails' `assert_routing`
469
+ - Available in routing and controller specs
406
470
 
407
471
  ```ruby
408
472
  expect(:get => "/widgets").to route_to(:controller => "widgets", :action => "index")
409
473
  ```
410
474
 
411
- ## `be_routable`
475
+ ### `be_routable`
412
476
 
413
477
  Passes if the path is recognized by Rails' routing. This is primarily intended
414
- to be used with `not_to` to specify routes that should not be routable.
478
+ to be used with `not_to` to specify standard CRUD routes which should not be
479
+ routable.
415
480
 
416
481
  ```ruby
417
482
  expect(:get => "/widgets/1/edit").not_to be_routable
418
483
  ```
419
484
 
420
- ## `have_http_status`
485
+ ### `have_http_status`
421
486
 
422
- * Passes if `response` has a matching HTTP status code
423
- * The following symbolic status codes are allowed:
487
+ - Passes if `response` has a matching HTTP status code
488
+ - The following symbolic status codes are allowed:
424
489
  - `Rack::Utils::SYMBOL_TO_STATUS_CODE`
425
490
  - One of the defined `ActionDispatch::TestResponse` aliases:
426
491
  - `:error`
427
492
  - `:missing`
428
493
  - `:redirect`
429
494
  - `:success`
430
- * Available in controller, feature, and request specs.
495
+ - Available in controller, feature, and request specs.
431
496
 
432
497
  In controller and request specs, apply to the `response` object:
433
498
 
@@ -442,15 +507,16 @@ In feature specs, apply to the `page` object:
442
507
  expect(page).to have_http_status(:success)
443
508
  ```
444
509
 
445
- # `rake` tasks
510
+ ## `rake` tasks
446
511
 
447
- `rspec-rails` defines rake tasks to run the entire test suite (`rake spec`)
448
- and subsets of tests (e.g., `rake spec:models`).
512
+ Several rake tasks are provided as a convience for working with RSpec. To run
513
+ the entire spec suite use `rake spec`. To run a subset of specs use the
514
+ associated type task, for example `rake spec:models`.
449
515
 
450
516
  A full list of the available rake tasks can be seen by running `rake -T | grep
451
517
  spec`.
452
518
 
453
- ## Customizing `rake` tasks
519
+ ### Customizing `rake` tasks
454
520
 
455
521
  If you want to customize the behavior of `rake spec`, you may [define your own
456
522
  task in the `Rakefile` for your
@@ -461,14 +527,14 @@ However, you must first clear the task that rspec-rails defined:
461
527
  task("spec").clear
462
528
  ```
463
529
 
464
- # Contribute
530
+ ## Contribute
465
531
 
466
532
  See [http://github.com/rspec/rspec-dev](http://github.com/rspec/rspec-dev).
467
533
 
468
534
  For `rspec-rails`-specific development information, see
469
535
  [README_DEV](https://github.com/rspec/rspec-rails/blob/master/README_DEV.md).
470
536
 
471
- # Also see
537
+ ## Also see
472
538
 
473
539
  * [http://github.com/rspec/rspec](http://github.com/rspec/rspec)
474
540
  * [http://github.com/rspec/rspec-core](http://github.com/rspec/rspec-core)
@@ -4,9 +4,9 @@ require 'rails_helper'
4
4
  RSpec.describe <%= class_name %>Controller, :type => :controller do
5
5
 
6
6
  <% for action in actions -%>
7
- describe "GET '<%= action %>'" do
7
+ describe "GET <%= action %>" do
8
8
  it "returns http success" do
9
- get '<%= action %>'
9
+ get :<%= action %>
10
10
  expect(response).to be_success
11
11
  end
12
12
  end
@@ -9,7 +9,7 @@ require 'rspec/rails'
9
9
  # run as spec files by default. This means that files in spec/support that end
10
10
  # in _spec.rb will both be required and run as specs, causing the specs to be
11
11
  # run twice. It is recommended that you do not name files matching this glob to
12
- # end with _spec.rb. You can configure this pattern with with the --pattern
12
+ # end with _spec.rb. You can configure this pattern with the --pattern
13
13
  # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
14
14
  Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
15
15
 
@@ -5,7 +5,11 @@ require 'active_support/concern'
5
5
  module RSpec
6
6
  module Rails
7
7
  if ::Rails::VERSION::STRING >= '4.1.0'
8
- gem 'minitest'
8
+ if defined?(Kernel.gem)
9
+ gem 'minitest'
10
+ else
11
+ require 'minitest'
12
+ end
9
13
  require 'minitest/assertions'
10
14
  # Constant aliased to either Minitest or TestUnit, depending on what is
11
15
  # loaded.
@@ -120,6 +124,10 @@ module RSpec
120
124
  end
121
125
  end
122
126
 
127
+ def initialize
128
+ @example = nil
129
+ end
130
+
123
131
  def method_name
124
132
  @example
125
133
  end
@@ -3,7 +3,7 @@ module RSpec
3
3
  # Version information for RSpec Rails.
4
4
  module Version
5
5
  # Current version of RSpec Rails, in semantic versioning format.
6
- STRING = '3.0.1'
6
+ STRING = '3.0.2'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chelimsky
@@ -9,178 +9,171 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain:
12
- - !binary |-
13
- LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURqakNDQW5hZ0F3SUJB
14
- Z0lCQVRBTkJna3Foa2lHOXcwQkFRVUZBREJHTVJJd0VBWURWUVFEREFseWMz
15
- QmwKWXkxa1pYWXhHekFaQmdvSmtpYUprL0lzWkFFWkZndG5iMjluYkdWbmIz
16
- VndjekVUTUJFR0NnbVNKb21UOGl4awpBUmtXQTJOdmJUQWVGdzB4TXpFeE1E
17
- Y3hPVFF5TlRsYUZ3MHhOREV4TURjeE9UUXlOVGxhTUVZeEVqQVFCZ05WCkJB
18
- TU1DWEp6Y0dWakxXUmxkakViTUJrR0NnbVNKb21UOGl4a0FSa1dDMmR2YjJk
19
- c1pXZHZkWEJ6TVJNd0VRWUsKQ1pJbWlaUHlMR1FCR1JZRFkyOXRNSUlCSWpB
20
- TkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQQpuaENlWm91
21
- RExYV081NW5vK0VkWk5DdGpYamZKUTFYOVR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gSwMB0GA1UdDgQWBBSW+WD7hn1swJ1A7i8tbuFeuNCJCjAkBgNVHREEHTAbgRly
26
+ c3BlYy1kZXZAZ29vZ2xlZ291cHMuY29tMCQGA1UdEgQdMBuBGXJzcGVjLWRldkBn
27
+ b29nbGVnb3Vwcy5jb20wDQYJKoZIhvcNAQEFBQADggEBAH27jAZ8sD7vnXupj6Y+
28
+ BaBdfHtCkFaslLJ0aKuMDIVXwYuKfqoW15cZPDLmSIEBuQFM3lw6d/hEEL4Uo2jZ
29
+ FvtmH5OxifPDzFyUtCL4yp6qgNe/Xf6sDsRg6FmKcpgqCwNOmsViaf0LPSUH/GYQ
30
+ 3Teoz8QCaDbD7AKsffT7eDrnbHnKweO1XdemRJC98u/yYxnGzMSWKEsn09etBlZ9
31
+ 7H67k5Z3uf6cfLZgToWL6zShzZY3Nun5r73YsNf2/QZOe4UZe4vfGvn6baw53ys9
32
+ 1yHC1AcSYpvi2dAbOiHT5iQF+krm4wse8KctXgTNnjMsHEoGKulJS2/sZl90jcCz
33
+ muA=
34
+ -----END CERTIFICATE-----
35
+ date: 2014-07-21 00:00:00.000000000 Z
43
36
  dependencies:
44
37
  - !ruby/object:Gem::Dependency
45
38
  name: activesupport
46
39
  requirement: !ruby/object:Gem::Requirement
47
40
  requirements:
48
- - - ! '>='
41
+ - - ">="
49
42
  - !ruby/object:Gem::Version
50
43
  version: '3.0'
51
44
  type: :runtime
52
45
  prerelease: false
53
46
  version_requirements: !ruby/object:Gem::Requirement
54
47
  requirements:
55
- - - ! '>='
48
+ - - ">="
56
49
  - !ruby/object:Gem::Version
57
50
  version: '3.0'
58
51
  - !ruby/object:Gem::Dependency
59
52
  name: actionpack
60
53
  requirement: !ruby/object:Gem::Requirement
61
54
  requirements:
62
- - - ! '>='
55
+ - - ">="
63
56
  - !ruby/object:Gem::Version
64
57
  version: '3.0'
65
58
  type: :runtime
66
59
  prerelease: false
67
60
  version_requirements: !ruby/object:Gem::Requirement
68
61
  requirements:
69
- - - ! '>='
62
+ - - ">="
70
63
  - !ruby/object:Gem::Version
71
64
  version: '3.0'
72
65
  - !ruby/object:Gem::Dependency
73
66
  name: railties
74
67
  requirement: !ruby/object:Gem::Requirement
75
68
  requirements:
76
- - - ! '>='
69
+ - - ">="
77
70
  - !ruby/object:Gem::Version
78
71
  version: '3.0'
79
72
  type: :runtime
80
73
  prerelease: false
81
74
  version_requirements: !ruby/object:Gem::Requirement
82
75
  requirements:
83
- - - ! '>='
76
+ - - ">="
84
77
  - !ruby/object:Gem::Version
85
78
  version: '3.0'
86
79
  - !ruby/object:Gem::Dependency
87
80
  name: rspec-core
88
81
  requirement: !ruby/object:Gem::Requirement
89
82
  requirements:
90
- - - ~>
83
+ - - "~>"
91
84
  - !ruby/object:Gem::Version
92
85
  version: 3.0.0
93
86
  type: :runtime
94
87
  prerelease: false
95
88
  version_requirements: !ruby/object:Gem::Requirement
96
89
  requirements:
97
- - - ~>
90
+ - - "~>"
98
91
  - !ruby/object:Gem::Version
99
92
  version: 3.0.0
100
93
  - !ruby/object:Gem::Dependency
101
94
  name: rspec-expectations
102
95
  requirement: !ruby/object:Gem::Requirement
103
96
  requirements:
104
- - - ~>
97
+ - - "~>"
105
98
  - !ruby/object:Gem::Version
106
99
  version: 3.0.0
107
100
  type: :runtime
108
101
  prerelease: false
109
102
  version_requirements: !ruby/object:Gem::Requirement
110
103
  requirements:
111
- - - ~>
104
+ - - "~>"
112
105
  - !ruby/object:Gem::Version
113
106
  version: 3.0.0
114
107
  - !ruby/object:Gem::Dependency
115
108
  name: rspec-mocks
116
109
  requirement: !ruby/object:Gem::Requirement
117
110
  requirements:
118
- - - ~>
111
+ - - "~>"
119
112
  - !ruby/object:Gem::Version
120
113
  version: 3.0.0
121
114
  type: :runtime
122
115
  prerelease: false
123
116
  version_requirements: !ruby/object:Gem::Requirement
124
117
  requirements:
125
- - - ~>
118
+ - - "~>"
126
119
  - !ruby/object:Gem::Version
127
120
  version: 3.0.0
128
121
  - !ruby/object:Gem::Dependency
129
122
  name: rspec-support
130
123
  requirement: !ruby/object:Gem::Requirement
131
124
  requirements:
132
- - - ~>
125
+ - - "~>"
133
126
  - !ruby/object:Gem::Version
134
127
  version: 3.0.0
135
128
  type: :runtime
136
129
  prerelease: false
137
130
  version_requirements: !ruby/object:Gem::Requirement
138
131
  requirements:
139
- - - ~>
132
+ - - "~>"
140
133
  - !ruby/object:Gem::Version
141
134
  version: 3.0.0
142
135
  - !ruby/object:Gem::Dependency
143
136
  name: rake
144
137
  requirement: !ruby/object:Gem::Requirement
145
138
  requirements:
146
- - - ~>
139
+ - - "~>"
147
140
  - !ruby/object:Gem::Version
148
141
  version: 10.0.0
149
142
  type: :development
150
143
  prerelease: false
151
144
  version_requirements: !ruby/object:Gem::Requirement
152
145
  requirements:
153
- - - ~>
146
+ - - "~>"
154
147
  - !ruby/object:Gem::Version
155
148
  version: 10.0.0
156
149
  - !ruby/object:Gem::Dependency
157
150
  name: cucumber
158
151
  requirement: !ruby/object:Gem::Requirement
159
152
  requirements:
160
- - - ~>
153
+ - - "~>"
161
154
  - !ruby/object:Gem::Version
162
155
  version: 1.3.5
163
156
  type: :development
164
157
  prerelease: false
165
158
  version_requirements: !ruby/object:Gem::Requirement
166
159
  requirements:
167
- - - ~>
160
+ - - "~>"
168
161
  - !ruby/object:Gem::Version
169
162
  version: 1.3.5
170
163
  - !ruby/object:Gem::Dependency
171
164
  name: aruba
172
165
  requirement: !ruby/object:Gem::Requirement
173
166
  requirements:
174
- - - ~>
167
+ - - "~>"
175
168
  - !ruby/object:Gem::Version
176
- version: 0.4.11
169
+ version: 0.5.4
177
170
  type: :development
178
171
  prerelease: false
179
172
  version_requirements: !ruby/object:Gem::Requirement
180
173
  requirements:
181
- - - ~>
174
+ - - "~>"
182
175
  - !ruby/object:Gem::Version
183
- version: 0.4.11
176
+ version: 0.5.4
184
177
  - !ruby/object:Gem::Dependency
185
178
  name: ammeter
186
179
  requirement: !ruby/object:Gem::Requirement
@@ -201,6 +194,12 @@ executables: []
201
194
  extensions: []
202
195
  extra_rdoc_files: []
203
196
  files:
197
+ - ".document"
198
+ - ".yardopts"
199
+ - Capybara.md
200
+ - Changelog.md
201
+ - License.txt
202
+ - README.md
204
203
  - lib/generators/rspec.rb
205
204
  - lib/generators/rspec/controller/controller_generator.rb
206
205
  - lib/generators/rspec/controller/templates/controller_spec.rb
@@ -261,36 +260,30 @@ files:
261
260
  - lib/rspec/rails/version.rb
262
261
  - lib/rspec/rails/view_assigns.rb
263
262
  - lib/rspec/rails/view_rendering.rb
264
- - README.md
265
- - License.txt
266
- - Changelog.md
267
- - Capybara.md
268
- - .yardopts
269
- - .document
270
263
  homepage: http://github.com/rspec/rspec-rails
271
264
  licenses:
272
265
  - MIT
273
266
  metadata: {}
274
267
  post_install_message:
275
268
  rdoc_options:
276
- - --charset=UTF-8
269
+ - "--charset=UTF-8"
277
270
  require_paths:
278
271
  - lib
279
272
  required_ruby_version: !ruby/object:Gem::Requirement
280
273
  requirements:
281
- - - ! '>='
274
+ - - ">="
282
275
  - !ruby/object:Gem::Version
283
276
  version: '0'
284
277
  required_rubygems_version: !ruby/object:Gem::Requirement
285
278
  requirements:
286
- - - ! '>='
279
+ - - ">="
287
280
  - !ruby/object:Gem::Version
288
281
  version: '0'
289
282
  requirements: []
290
283
  rubyforge_project: rspec
291
- rubygems_version: 2.0.7
284
+ rubygems_version: 2.2.2
292
285
  signing_key:
293
286
  specification_version: 4
294
- summary: rspec-rails-3.0.1
287
+ summary: rspec-rails-3.0.2
295
288
  test_files: []
296
289
  has_rdoc:
metadata.gz.sig CHANGED
Binary file