rspec-rails 2.99.0.beta2 → 2.99.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/Changelog.md +49 -32
- data/lib/generators/rspec/install/templates/spec/spec_helper.rb.tt +28 -3
- data/lib/rspec/rails.rb +4 -0
- data/lib/rspec/rails/example/controller_example_group.rb +26 -2
- data/lib/rspec/rails/infer_type_configuration.rb +26 -0
- data/lib/rspec/rails/mocks.rb +19 -5
- data/lib/rspec/rails/tasks/rspec.rake +12 -5
- data/lib/rspec/rails/version.rb +1 -1
- metadata +41 -218
- data/features/Autotest.md +0 -24
- data/features/Generators.md +0 -24
- data/features/GettingStarted.md +0 -84
- data/features/README.md +0 -56
- data/features/RailsVersions.md +0 -4
- data/features/Transactions.md +0 -84
- data/features/Upgrade.md +0 -121
- data/features/controller_specs/Cookies.md +0 -57
- data/features/controller_specs/README.md +0 -45
- data/features/controller_specs/anonymous_controller.feature +0 -378
- data/features/controller_specs/bypass_rescue.feature +0 -75
- data/features/controller_specs/capybara.feature +0 -44
- data/features/controller_specs/controller_spec.feature +0 -58
- data/features/controller_specs/engine_routes.feature +0 -51
- data/features/controller_specs/isolation_from_views.feature +0 -87
- data/features/controller_specs/render_views.feature +0 -114
- data/features/feature_specs/feature_spec.feature +0 -34
- data/features/helper_specs/helper_spec.feature +0 -122
- data/features/mailer_specs/url_helpers.feature +0 -38
- data/features/matchers/README.md +0 -18
- data/features/matchers/new_record_matcher.feature +0 -41
- data/features/matchers/redirect_to_matcher.feature +0 -40
- data/features/matchers/relation_match_array.feature +0 -27
- data/features/matchers/render_template_matcher.feature +0 -49
- data/features/mocks/mock_model.feature +0 -147
- data/features/mocks/stub_model.feature +0 -58
- data/features/model_specs/README.md +0 -21
- data/features/model_specs/errors_on.feature +0 -51
- data/features/model_specs/records.feature +0 -27
- data/features/model_specs/transactional_examples.feature +0 -109
- data/features/request_specs/request_spec.feature +0 -49
- data/features/routing_specs/README.md +0 -16
- data/features/routing_specs/be_routable_matcher.feature +0 -80
- data/features/routing_specs/engine_routes.feature +0 -38
- data/features/routing_specs/named_routes.feature +0 -18
- data/features/routing_specs/route_to_matcher.feature +0 -90
- data/features/step_definitions/additional_cli_steps.rb +0 -4
- data/features/step_definitions/model_steps.rb +0 -3
- data/features/support/env.rb +0 -53
- data/features/support/rails_versions.rb +0 -4
- data/features/support/rubinius.rb +0 -6
- data/features/view_specs/inferred_controller_path.feature +0 -45
- data/features/view_specs/stub_template.feature +0 -51
- data/features/view_specs/view_spec.feature +0 -206
- data/spec/autotest/rails_rspec2_spec.rb +0 -36
- data/spec/generators/rspec/controller/controller_generator_spec.rb +0 -97
- data/spec/generators/rspec/helper/helper_generator_spec.rb +0 -30
- data/spec/generators/rspec/install/install_generator_spec.rb +0 -30
- data/spec/generators/rspec/integration/integration_generator_spec.rb +0 -57
- data/spec/generators/rspec/mailer/mailer_generator_spec.rb +0 -48
- data/spec/generators/rspec/model/model_generator_spec.rb +0 -52
- data/spec/generators/rspec/observer/observer_generator_spec.rb +0 -21
- data/spec/generators/rspec/scaffold/scaffold_generator_spec.rb +0 -150
- data/spec/generators/rspec/view/view_generator_spec.rb +0 -41
- data/spec/rspec/rails/assertion_adapter_spec.rb +0 -28
- data/spec/rspec/rails/assertion_delegator_spec.rb +0 -43
- data/spec/rspec/rails/configuration_spec.rb +0 -26
- data/spec/rspec/rails/deprecations_spec.rb +0 -18
- data/spec/rspec/rails/example/controller_example_group_spec.rb +0 -126
- data/spec/rspec/rails/example/feature_example_group_spec.rb +0 -56
- data/spec/rspec/rails/example/helper_example_group_spec.rb +0 -66
- data/spec/rspec/rails/example/mailer_example_group_spec.rb +0 -21
- data/spec/rspec/rails/example/model_example_group_spec.rb +0 -15
- data/spec/rspec/rails/example/request_example_group_spec.rb +0 -17
- data/spec/rspec/rails/example/routing_example_group_spec.rb +0 -32
- data/spec/rspec/rails/example/view_example_group_spec.rb +0 -235
- data/spec/rspec/rails/extensions/active_model/errors_on_spec.rb +0 -23
- data/spec/rspec/rails/extensions/active_record/base_spec.rb +0 -42
- data/spec/rspec/rails/fixture_support_spec.rb +0 -17
- data/spec/rspec/rails/matchers/be_a_new_spec.rb +0 -142
- data/spec/rspec/rails/matchers/be_new_record_spec.rb +0 -33
- data/spec/rspec/rails/matchers/be_routable_spec.rb +0 -41
- data/spec/rspec/rails/matchers/be_valid_spec.rb +0 -43
- data/spec/rspec/rails/matchers/errors_on_spec.rb +0 -38
- data/spec/rspec/rails/matchers/has_spec.rb +0 -29
- data/spec/rspec/rails/matchers/have_rendered_spec.rb +0 -93
- data/spec/rspec/rails/matchers/redirect_to_spec.rb +0 -81
- data/spec/rspec/rails/matchers/relation_match_array_spec.rb +0 -31
- data/spec/rspec/rails/matchers/route_to_spec.rb +0 -151
- data/spec/rspec/rails/minitest_lifecycle_adapter_spec.rb +0 -31
- data/spec/rspec/rails/mocks/mock_model_spec.rb +0 -401
- data/spec/rspec/rails/mocks/stub_model_spec.rb +0 -154
- data/spec/rspec/rails/setup_and_teardown_adapter_spec.rb +0 -32
- data/spec/rspec/rails/view_rendering_spec.rb +0 -111
- data/spec/spec_helper.rb +0 -32
- data/spec/support/ar_classes.rb +0 -42
- data/spec/support/helpers.rb +0 -34
- data/spec/support/matchers.rb +0 -9
- data/spec/support/null_object.rb +0 -6
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
YWU5ZWVhNWFiYzdiZWY1ZWQ0OWYyMjEyZTIwOTJjZDIxODBjM2Q1ZTljMDg1
|
10
|
-
MTdhYzFjZjlhYjBhNjlmNTk1YTFkMGU1YTk0M2ZjM2NmMDE5NTNlOTI0MmQ3
|
11
|
-
OGVhMDRjZjRjNjI2NWJkZGY3YzU2Yjc3ZGI0NTM1YjFkYzU4MDQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
OGJjZTRhNWZjMWQyMGUzYzcyNzc5OTNjZWVkMTVjMDBjZWJmN2NjNjQ0NWJh
|
14
|
-
ZTk2M2M4MTVkNWJkMTliZDY2YWViODIwNDIwYzRlOTMzOTVmNjJjZTIzYTc3
|
15
|
-
Yjg4ZWFhZDY5OTEyZmE3N2Y0ZGVhMmIwYmQ3NmFmOTVhYmZmYmE=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b93f5ce3e1a3da43f65e8a266e931ddae467fef5
|
4
|
+
data.tar.gz: 1a2ff9f79df901ae083e7ae865143979e092322a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 767517cd2fd72a646b645c72efbaf023889e26e92137399f44e35730fb7bfa18aae11aff2bdf3e7ad945866d5cda166047e7f36518eba3645972aad9921a2c14
|
7
|
+
data.tar.gz: 95f96d3834dd209ca27e2926b8a62c984da753d9e2ea38bd3632fb06afd6cb3885c4b5075caf2c9420968b20cfd61fc80142403ca2c5cd82731bda1a529289a9
|
data/Changelog.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
|
+
### 2.99.0.rc1 / 2014-05-18
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.99.0.beta2...v2.99.0.rc1)
|
3
|
+
|
4
|
+
Deprecations
|
5
|
+
|
6
|
+
* Deprecates `stub_model` and `mock_model` in favor of the
|
7
|
+
`rspec-activemodel-mocks` gem. (Thomas Holmes)
|
8
|
+
* Issue a deprecation to instruct users to configure
|
9
|
+
`config.infer_spec_type_from_file_location!` during the
|
10
|
+
upgrade process since spec type inference is opt-in in 3.0.
|
11
|
+
(Jon Rowe)
|
12
|
+
* Issue a deprecation when `described_class` is accessed in a controller
|
13
|
+
example group that has used the `controller { }` macro to generate an
|
14
|
+
anonymous controller class, since in 2.x, `described_class` would
|
15
|
+
return that generated class but in 3.0 it will continue returning the
|
16
|
+
class passed to `describe`. (Myron Marston)
|
17
|
+
|
1
18
|
### 2.99.0.beta2 / 2014-02-17
|
2
|
-
[
|
19
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.99.0.beta1...v2.99.0.beta2)
|
3
20
|
|
4
21
|
Bug fixes
|
5
22
|
|
@@ -17,7 +34,7 @@ Deprecations
|
|
17
34
|
instead. (Andy Lindeman)
|
18
35
|
|
19
36
|
### 2.99.0.beta1 / 2013-11-07
|
20
|
-
[
|
37
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.14.0...v2.99.0.beta1)
|
21
38
|
|
22
39
|
Deprecations
|
23
40
|
|
@@ -39,7 +56,7 @@ Bug fixes
|
|
39
56
|
in all of `rails` to use `rspec-rails`. (John Firebaugh)
|
40
57
|
|
41
58
|
### 2.14.0 / 2013-07-06
|
42
|
-
[
|
59
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.14.0.rc1...v2.14.0)
|
43
60
|
|
44
61
|
Bug fixes
|
45
62
|
|
@@ -51,7 +68,7 @@ Bug fixes
|
|
51
68
|
Rails 4. (Andy Lindeman)
|
52
69
|
|
53
70
|
### 2.14.0.rc1 / 2013-05-27
|
54
|
-
[
|
71
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.13.2...v2.14.0.rc1)
|
55
72
|
|
56
73
|
Enhancements
|
57
74
|
|
@@ -64,7 +81,7 @@ Bug fixes
|
|
64
81
|
spec/ directory. (Benjamin Fleischer)
|
65
82
|
|
66
83
|
### 2.13.2 / 2013-05-18
|
67
|
-
[
|
84
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.13.1...v2.13.2)
|
68
85
|
|
69
86
|
Bug fixes
|
70
87
|
|
@@ -75,7 +92,7 @@ Bug fixes
|
|
75
92
|
not fully loaded. (Andy Lindeman)
|
76
93
|
|
77
94
|
### 2.13.1 / 2013-04-27
|
78
|
-
[
|
95
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.13.0...v2.13.1)
|
79
96
|
|
80
97
|
Bug fixes
|
81
98
|
|
@@ -89,7 +106,7 @@ Bug fixes
|
|
89
106
|
* Fix spacing in the install generator template (Taiki ONO)
|
90
107
|
|
91
108
|
### 2.13.0 / 2013-02-23
|
92
|
-
[
|
109
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.12.2...v2.13.0)
|
93
110
|
|
94
111
|
Enhancements
|
95
112
|
|
@@ -104,7 +121,7 @@ Enhancements
|
|
104
121
|
(Rudolf Schmidt)
|
105
122
|
|
106
123
|
### 2.12.2 / 2013-01-12
|
107
|
-
[
|
124
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.12.1...v2.12.2)
|
108
125
|
|
109
126
|
Bug fixes
|
110
127
|
|
@@ -116,7 +133,7 @@ Bug fixes
|
|
116
133
|
Lindeman)
|
117
134
|
|
118
135
|
### 2.12.1 / 2013-01-07
|
119
|
-
[
|
136
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.12.0...v2.12.1)
|
120
137
|
|
121
138
|
Bug fixes
|
122
139
|
|
@@ -131,7 +148,7 @@ Bug fixes
|
|
131
148
|
and generation of URLs from other contexts. (Andy Lindeman)
|
132
149
|
|
133
150
|
### 2.12.0 / 2012-11-12
|
134
|
-
[
|
151
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.11.4...v2.12.0)
|
135
152
|
|
136
153
|
Enhancements
|
137
154
|
|
@@ -152,7 +169,7 @@ Bug fixes
|
|
152
169
|
* Failures message for `be_new_record` are more useful (Andy Lindeman)
|
153
170
|
|
154
171
|
### 2.11.4 / 2012-10-14
|
155
|
-
[
|
172
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.11.0...v2.11.4)
|
156
173
|
|
157
174
|
Capybara-2.0 integration support:
|
158
175
|
|
@@ -166,7 +183,7 @@ for background.
|
|
166
183
|
2.11.1, .2, .3 were yanked due to errant documentation.
|
167
184
|
|
168
185
|
### 2.11.0 / 2012-07-07
|
169
|
-
[
|
186
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.10.1...v2.11.0)
|
170
187
|
|
171
188
|
Enhancements
|
172
189
|
|
@@ -185,7 +202,7 @@ Bug fixes
|
|
185
202
|
loads (Andy Lindeman)
|
186
203
|
|
187
204
|
### 2.10.1 / 2012-05-03
|
188
|
-
[
|
205
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.10.0...v2.10.1)
|
189
206
|
|
190
207
|
Bug fixes
|
191
208
|
|
@@ -195,7 +212,7 @@ Bug fixes
|
|
195
212
|
Rails already does this (Jack Dempsey)
|
196
213
|
|
197
214
|
### 2.10.0 / 2012-05-03
|
198
|
-
[
|
215
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.9.0...v2.10.0)
|
199
216
|
|
200
217
|
Bug fixes
|
201
218
|
|
@@ -210,7 +227,7 @@ Bug fixes
|
|
210
227
|
Strother)
|
211
228
|
|
212
229
|
### 2.9.0 / 2012-03-17
|
213
|
-
[
|
230
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.8.1...v2.9.0)
|
214
231
|
|
215
232
|
Enhancements
|
216
233
|
|
@@ -225,7 +242,7 @@ Bug fixes
|
|
225
242
|
|
226
243
|
### 2.8.1 / 2012-01-04
|
227
244
|
|
228
|
-
[
|
245
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.8.0...v2.8.1)
|
229
246
|
|
230
247
|
NOTE: there was a change in rails-3.2.0.rc2 which broke compatibility with
|
231
248
|
stub_model in rspec-rails. This release fixes that issue, but it means that
|
@@ -238,7 +255,7 @@ you'll have to upgrade to rspec-rails-2.8.1 when you upgrade to rails >=
|
|
238
255
|
|
239
256
|
### 2.8.0 / 2012-01-04
|
240
257
|
|
241
|
-
[
|
258
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.8.0.rc2...v2.8.0)
|
242
259
|
|
243
260
|
* Enhancements
|
244
261
|
* Eliminate deprecation warnings in generated view specs in Rails 3.2
|
@@ -248,7 +265,7 @@ you'll have to upgrade to rspec-rails-2.8.1 when you upgrade to rails >=
|
|
248
265
|
|
249
266
|
### 2.8.0.rc2 / 2011-12-19
|
250
267
|
|
251
|
-
[
|
268
|
+
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.8.0.rc1...v2.8.0.rc2)
|
252
269
|
|
253
270
|
* Enhancements
|
254
271
|
* Add session hash to generated controller specs (Thiago Almeida)
|
@@ -260,7 +277,7 @@ you'll have to upgrade to rspec-rails-2.8.1 when you upgrade to rails >=
|
|
260
277
|
|
261
278
|
### 2.8.0.rc1 / 2011-11-06
|
262
279
|
|
263
|
-
[
|
280
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.7.0...v2.8.0.rc1)
|
264
281
|
|
265
282
|
* Enhancements
|
266
283
|
* Removed unnecessary "config.mock_with :rspec" from spec_helper.rb (Paul
|
@@ -276,7 +293,7 @@ you'll have to upgrade to rspec-rails-2.8.1 when you upgrade to rails >=
|
|
276
293
|
|
277
294
|
### 2.7.0 / 2011-10-16
|
278
295
|
|
279
|
-
[
|
296
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.6.1...v2.7.0)
|
280
297
|
|
281
298
|
* Enhancements
|
282
299
|
* `ActiveRecord::Relation` can use the `=~` matcher (Andy Lindeman)
|
@@ -301,7 +318,7 @@ you'll have to upgrade to rspec-rails-2.8.1 when you upgrade to rails >=
|
|
301
318
|
|
302
319
|
### 2.6.1 / 2011-05-25
|
303
320
|
|
304
|
-
[
|
321
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.6.0...v2.6.1)
|
305
322
|
|
306
323
|
This release is compatible with rails-3.1.0.rc1, but not rails-3.1.0.beta1
|
307
324
|
|
@@ -312,7 +329,7 @@ This release is compatible with rails-3.1.0.rc1, but not rails-3.1.0.beta1
|
|
312
329
|
|
313
330
|
### 2.6.0 / 2011-05-12
|
314
331
|
|
315
|
-
[
|
332
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.5.0...v2.6.0)
|
316
333
|
|
317
334
|
* Enhancements
|
318
335
|
* rails 3 shortcuts for routing specs (Joe Fiorini)
|
@@ -336,7 +353,7 @@ This release is compatible with rails-3.1.0.rc1, but not rails-3.1.0.beta1
|
|
336
353
|
|
337
354
|
### 2.5.0 / 2011-02-05
|
338
355
|
|
339
|
-
[
|
356
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.4.1...v2.5.0)
|
340
357
|
|
341
358
|
* Enhancements
|
342
359
|
* use index_helper instead of table_name when generating specs (Reza
|
@@ -351,7 +368,7 @@ This release is compatible with rails-3.1.0.rc1, but not rails-3.1.0.beta1
|
|
351
368
|
|
352
369
|
### 2.4.1 / 2011-01-03
|
353
370
|
|
354
|
-
[
|
371
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.4.0...v2.4.1)
|
355
372
|
|
356
373
|
* Bug fixes
|
357
374
|
* fixed bug caused by including some Rails modules before RSpec's
|
@@ -359,7 +376,7 @@ This release is compatible with rails-3.1.0.rc1, but not rails-3.1.0.beta1
|
|
359
376
|
|
360
377
|
### 2.4.0 / 2011-01-02
|
361
378
|
|
362
|
-
[
|
379
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.3.1...v2.4.0)
|
363
380
|
|
364
381
|
* Enhancements
|
365
382
|
* include ApplicationHelper in helper object in helper specs
|
@@ -379,7 +396,7 @@ This release is compatible with rails-3.1.0.rc1, but not rails-3.1.0.beta1
|
|
379
396
|
|
380
397
|
### 2.3.1 / 2010-12-16
|
381
398
|
|
382
|
-
[
|
399
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.3.0...v2.3.1)
|
383
400
|
|
384
401
|
* Bug fixes
|
385
402
|
* respond_to? correctly handles 2 args
|
@@ -387,7 +404,7 @@ This release is compatible with rails-3.1.0.rc1, but not rails-3.1.0.beta1
|
|
387
404
|
|
388
405
|
### 2.3.0 / 2010-12-12
|
389
406
|
|
390
|
-
[
|
407
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.2.1...v2.3.0)
|
391
408
|
|
392
409
|
* Changes
|
393
410
|
* Generator no longer generates autotest/autodiscover.rb, as it is no longer
|
@@ -395,7 +412,7 @@ This release is compatible with rails-3.1.0.rc1, but not rails-3.1.0.beta1
|
|
395
412
|
|
396
413
|
### 2.2.1 / 2010-12-01
|
397
414
|
|
398
|
-
[
|
415
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.2.0...v2.2.1)
|
399
416
|
|
400
417
|
* Bug fixes
|
401
418
|
* Depend on railties, activesupport, and actionpack instead of rails (Piotr
|
@@ -407,7 +424,7 @@ This release is compatible with rails-3.1.0.rc1, but not rails-3.1.0.beta1
|
|
407
424
|
|
408
425
|
### 2.2.0 / 2010-11-28
|
409
426
|
|
410
|
-
[
|
427
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.1.0...v2.2.0)
|
411
428
|
|
412
429
|
* Enhancements
|
413
430
|
* Added stub_template in view specs
|
@@ -422,7 +439,7 @@ This release is compatible with rails-3.1.0.rc1, but not rails-3.1.0.beta1
|
|
422
439
|
|
423
440
|
### 2.1.0 / 2010-11-07
|
424
441
|
|
425
|
-
[
|
442
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.0.1...v2.1.0)
|
426
443
|
|
427
444
|
* Enhancements
|
428
445
|
* Move errors_on to ActiveModel to support other AM-compliant ORMs
|
@@ -433,7 +450,7 @@ This release is compatible with rails-3.1.0.rc1, but not rails-3.1.0.beta1
|
|
433
450
|
|
434
451
|
### 2.0.1 / 2010-10-15
|
435
452
|
|
436
|
-
[
|
453
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v2.0.0...v2.0.1)
|
437
454
|
|
438
455
|
* Enhancements
|
439
456
|
* Add option to not generate request spec (--skip-request-specs)
|
@@ -446,7 +463,7 @@ This release is compatible with rails-3.1.0.rc1, but not rails-3.1.0.beta1
|
|
446
463
|
|
447
464
|
### 2.0.0 / 2010-10-10
|
448
465
|
|
449
|
-
[
|
466
|
+
[Full Changelog](https://github.com/rspec/rspec-rails/compare/ea6bdef...v2.0.0)
|
450
467
|
|
451
468
|
* Enhancements
|
452
469
|
* ControllerExampleGroup uses controller as the implicit subject by default (Paul Rosania)
|
@@ -3,11 +3,21 @@ ENV["RAILS_ENV"] ||= 'test'
|
|
3
3
|
require File.expand_path("../../config/environment", __FILE__)
|
4
4
|
require 'rspec/rails'
|
5
5
|
|
6
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
7
|
-
#
|
6
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
7
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
8
|
+
# run as spec files by default. This means that files in spec/support that end
|
9
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
10
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
11
|
+
# end with _spec.rb. You can configure this pattern with with the --pattern
|
12
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
8
13
|
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
9
14
|
|
10
|
-
<% if ::Rails::VERSION::STRING >= '4' -%>
|
15
|
+
<% if ::Rails::VERSION::STRING >= '4.1' -%>
|
16
|
+
# Checks for pending migrations before tests are run.
|
17
|
+
# If you are not using ActiveRecord, you can remove this line.
|
18
|
+
ActiveRecord::Migration.maintain_test_schema!
|
19
|
+
|
20
|
+
<% elsif ::Rails::VERSION::STRING >= '4' -%>
|
11
21
|
# Checks for pending migrations before tests are run.
|
12
22
|
# If you are not using ActiveRecord, you can remove this line.
|
13
23
|
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
@@ -40,4 +50,19 @@ RSpec.configure do |config|
|
|
40
50
|
# the seed, which is printed after each run.
|
41
51
|
# --seed 1234
|
42
52
|
config.order = "random"
|
53
|
+
|
54
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
55
|
+
# based on their file location, for example enabling you to call `get` and
|
56
|
+
# `post` in specs under `spec/controllers`.
|
57
|
+
#
|
58
|
+
# You can disable this behaviour by removing the line below, and instead
|
59
|
+
# explictly tag your specs with their type, e.g.:
|
60
|
+
#
|
61
|
+
# describe UsersController, :type => :controller do
|
62
|
+
# # ...
|
63
|
+
# end
|
64
|
+
#
|
65
|
+
# The different available types are documented in the features, such as in
|
66
|
+
# https://relishapp.com/rspec/rspec-rails/v/3-0/docs
|
67
|
+
config.infer_spec_type_from_file_location!
|
43
68
|
end
|
data/lib/rspec/rails.rb
CHANGED
@@ -11,8 +11,12 @@ require 'rspec/rails/view_rendering'
|
|
11
11
|
require 'rspec/rails/adapters'
|
12
12
|
require 'rspec/rails/matchers'
|
13
13
|
require 'rspec/rails/fixture_support'
|
14
|
+
|
15
|
+
# Load rspec-activemodel-mocks if available; otherwise fall back
|
16
|
+
# to the deprecated mock methods
|
14
17
|
require 'rspec/rails/mocks'
|
15
18
|
require 'rspec/rails/module_inclusion'
|
16
19
|
require 'rspec/rails/example'
|
20
|
+
require 'rspec/rails/infer_type_configuration'
|
17
21
|
require 'rspec/rails/vendor/capybara'
|
18
22
|
require 'rspec/rails/vendor/webrat'
|
@@ -59,11 +59,16 @@ module RSpec::Rails
|
|
59
59
|
base_class ||= RSpec.configuration.infer_base_class_for_anonymous_controllers? ?
|
60
60
|
controller_class :
|
61
61
|
root_controller
|
62
|
+
base_class ||= root_controller
|
62
63
|
|
63
|
-
|
64
|
+
new_controller_class = Class.new(base_class) do
|
64
65
|
def self.name; "AnonymousController"; end
|
65
66
|
end
|
66
|
-
|
67
|
+
new_controller_class.class_eval(&body)
|
68
|
+
|
69
|
+
(class << self; self; end).__send__(:define_method, :controller_class) { new_controller_class }
|
70
|
+
metadata[:example_group].delete(:described_class)
|
71
|
+
metadata[:example_group].extend DescribedClassDeprecation.new(new_controller_class)
|
67
72
|
|
68
73
|
before do
|
69
74
|
@orig_routes = self.routes
|
@@ -78,6 +83,25 @@ module RSpec::Rails
|
|
78
83
|
end
|
79
84
|
end
|
80
85
|
|
86
|
+
class DescribedClassDeprecation < Module
|
87
|
+
def initialize(value)
|
88
|
+
module_eval do
|
89
|
+
define_method :store_computed do |key|
|
90
|
+
return super(key) unless key == :described_class
|
91
|
+
|
92
|
+
RSpec.warn_deprecation(<<-EOS.gsub(/^\s+\|/,''))
|
93
|
+
|In RSpec 3, the `controller { }` macro no longer changes
|
94
|
+
|`described_class` to refer to the generated anonymous controller
|
95
|
+
|class. Instead of `described_class`, use `controller_class` to
|
96
|
+
|access the generated anonymous class.
|
97
|
+
|(`described_class` called from #{::RSpec::CallerFilter.first_non_rspec_line}.)
|
98
|
+
EOS
|
99
|
+
store(:described_class, value)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
81
105
|
# Specifies the routeset that will be used for the example group. This
|
82
106
|
# is most useful when testing Rails engines.
|
83
107
|
#
|
@@ -0,0 +1,26 @@
|
|
1
|
+
RSpec.configure do |config|
|
2
|
+
def config.infer_spec_type_from_file_location!
|
3
|
+
@infer_spec_type_from_file_location = true
|
4
|
+
end
|
5
|
+
|
6
|
+
def config.infer_spec_type_from_file_location?
|
7
|
+
@infer_spec_type_from_file_location ||= false
|
8
|
+
end
|
9
|
+
|
10
|
+
config.before do
|
11
|
+
unless config.infer_spec_type_from_file_location?
|
12
|
+
RSpec.warn_deprecation(<<-EOS.gsub(/^\s+\|/,''))
|
13
|
+
|rspec-rails 3 will no longer automatically infer an example group's spec type
|
14
|
+
|from the file location. You can explicitly opt-in to this feature using this
|
15
|
+
|snippet:
|
16
|
+
|
|
17
|
+
|RSpec.configure do |config|
|
18
|
+
| config.infer_spec_type_from_file_location!
|
19
|
+
|end
|
20
|
+
|
|
21
|
+
|If you wish to manually label spec types via metadata you can safely ignore
|
22
|
+
|this warning and continue upgrading to RSpec 3 without addressing it.
|
23
|
+
EOS
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/rspec/rails/mocks.rb
CHANGED
@@ -87,12 +87,13 @@ module RSpec
|
|
87
87
|
# * A String representing a Class that extends ActiveModel::Naming
|
88
88
|
# * A Class that extends ActiveModel::Naming
|
89
89
|
def mock_model(string_or_model_class, stubs = {})
|
90
|
+
RSpec.deprecate("`mock_model`", :replacement => "the `rspec-activemodel-mocks` gem")
|
90
91
|
if String === string_or_model_class
|
91
92
|
if Object.const_defined?(string_or_model_class)
|
92
93
|
model_class = Object.const_get(string_or_model_class)
|
93
94
|
else
|
94
95
|
model_class = Object.const_set(string_or_model_class, Class.new do
|
95
|
-
extend ActiveModel::Naming
|
96
|
+
extend ::ActiveModel::Naming
|
96
97
|
def self.primary_key; :id; end
|
97
98
|
end)
|
98
99
|
end
|
@@ -100,7 +101,7 @@ module RSpec
|
|
100
101
|
model_class = string_or_model_class
|
101
102
|
end
|
102
103
|
|
103
|
-
unless model_class.kind_of? ActiveModel::Naming
|
104
|
+
unless model_class.kind_of? ::ActiveModel::Naming
|
104
105
|
raise ArgumentError.new <<-EOM
|
105
106
|
The mock_model method can only accept as its first argument:
|
106
107
|
* A String representing a Class that does not exist
|
@@ -122,8 +123,8 @@ EOM
|
|
122
123
|
m.singleton_class.class_eval do
|
123
124
|
include ActiveModelInstanceMethods
|
124
125
|
include ActiveRecordInstanceMethods if defined?(ActiveRecord)
|
125
|
-
include ActiveModel::Conversion
|
126
|
-
include ActiveModel::Validations
|
126
|
+
include ::ActiveModel::Conversion
|
127
|
+
include ::ActiveModel::Validations
|
127
128
|
end
|
128
129
|
if defined?(ActiveRecord)
|
129
130
|
[:save, :update_attributes, :update].each do |key|
|
@@ -149,6 +150,10 @@ EOM
|
|
149
150
|
#{model_class}.respond_to?(:column_names) && #{model_class}.column_names.include?(method_name.to_s)
|
150
151
|
end
|
151
152
|
|
153
|
+
def @object.has_attribute?(attr_name)
|
154
|
+
__model_class_has_column?(attr_name)
|
155
|
+
end unless #{stubs.has_key?(:has_attribute?)}
|
156
|
+
|
152
157
|
def @object.respond_to?(method_name, include_private=false)
|
153
158
|
__model_class_has_column?(method_name) ? true : super
|
154
159
|
end unless #{stubs.has_key?(:respond_to?)}
|
@@ -230,6 +235,7 @@ EOM
|
|
230
235
|
# stub_model(Person, :to_param => 37)
|
231
236
|
# stub_model(Person) {|person| person.first_name = "David"}
|
232
237
|
def stub_model(model_class, stubs={})
|
238
|
+
RSpec.deprecate("`stub_model`", :replacement => "the `rspec-activemodel-mocks` gem")
|
233
239
|
model_class.new.tap do |m|
|
234
240
|
m.extend ActiveModelStubExtensions
|
235
241
|
if defined?(ActiveRecord) && model_class < ActiveRecord::Base
|
@@ -267,4 +273,12 @@ EOM
|
|
267
273
|
end
|
268
274
|
end
|
269
275
|
|
270
|
-
|
276
|
+
# We need to check if rspec-activemodel-mocks is in use on this side due
|
277
|
+
# to Rails defaults. Because rspec-activemodel-mocks does not depend on
|
278
|
+
# rspec-rails, bundler is likely to require rspec-activemodel-mocks before
|
279
|
+
# rspec-rails when Bundler.require is performed. This will result in the
|
280
|
+
# user still getting a deprecation message even when they are doing
|
281
|
+
# everything right.
|
282
|
+
unless defined?(RSpec::ActiveModel::Mocks::Mocks)
|
283
|
+
RSpec.configuration.include RSpec::Rails::Mocks
|
284
|
+
end
|