rspec-rails 2.13.0 → 2.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/Capybara.md +1 -3
  3. data/Changelog.md +14 -0
  4. data/README.md +46 -16
  5. data/features/Transactions.md +2 -2
  6. data/features/Upgrade.md +4 -0
  7. data/features/controller_specs/Cookies.md +1 -1
  8. data/features/controller_specs/README.md +9 -9
  9. data/features/controller_specs/controller_spec.feature +1 -1
  10. data/features/controller_specs/engine_routes.feature +51 -0
  11. data/features/helper_specs/helper_spec.feature +26 -0
  12. data/features/matchers/README.md +3 -3
  13. data/features/model_specs/errors_on.feature +1 -1
  14. data/features/routing_specs/README.md +6 -7
  15. data/features/routing_specs/engine_routes.feature +38 -0
  16. data/features/support/rails_versions.rb +4 -0
  17. data/lib/generators/rspec.rb +2 -1
  18. data/lib/generators/rspec/controller/controller_generator.rb +1 -1
  19. data/lib/generators/rspec/install/install_generator.rb +2 -0
  20. data/lib/generators/rspec/install/templates/spec/spec_helper.rb.tt +2 -2
  21. data/lib/generators/rspec/scaffold/scaffold_generator.rb +1 -1
  22. data/lib/generators/rspec/scaffold/templates/controller_spec.rb +4 -8
  23. data/lib/rspec/rails.rb +1 -0
  24. data/lib/rspec/rails/adapters.rb +30 -1
  25. data/lib/rspec/rails/example/controller_example_group.rb +43 -6
  26. data/lib/rspec/rails/example/rails_example_group.rb +2 -0
  27. data/lib/rspec/rails/example/routing_example_group.rb +28 -2
  28. data/lib/rspec/rails/example/view_example_group.rb +1 -1
  29. data/lib/rspec/rails/fixture_support.rb +1 -0
  30. data/lib/rspec/rails/matchers/routing_matchers.rb +1 -1
  31. data/lib/rspec/rails/mocks.rb +1 -1
  32. data/lib/rspec/rails/rails_version.rb +17 -0
  33. data/lib/rspec/rails/tasks/rspec.rake +8 -6
  34. data/lib/rspec/rails/version.rb +1 -1
  35. data/spec/generators/rspec/controller/controller_generator_spec.rb +11 -0
  36. data/spec/generators/rspec/install/install_generator_spec.rb +1 -1
  37. data/spec/generators/rspec/scaffold/scaffold_generator_spec.rb +23 -0
  38. data/spec/rspec/rails/assertion_delegator_spec.rb +13 -0
  39. data/spec/rspec/rails/example/view_example_group_spec.rb +1 -1
  40. data/spec/rspec/rails/matchers/have_rendered_spec.rb +3 -3
  41. data/spec/rspec/rails/matchers/relation_match_array_spec.rb +1 -1
  42. data/spec/rspec/rails/matchers/route_to_spec.rb +9 -10
  43. data/spec/rspec/rails/minitest_lifecycle_adapter_spec.rb +22 -0
  44. data/spec/rspec/rails/rails_version_spec.rb +29 -0
  45. data/spec/support/null_object.rb +6 -0
  46. metadata +67 -86
@@ -5,7 +5,7 @@ describe "ActiveSupport::Relation =~ matcher" do
5
5
 
6
6
  let!(:models) { Array.new(3) { MockableModel.create } }
7
7
 
8
- if Rails.version >= '4'
8
+ if RSpec::Rails.rails_version_satisfied_by?('>= 4.0.0.beta1')
9
9
  it "verifies that the scope returns the records on the right hand side, regardless of order" do
10
10
  MockableModel.all.should =~ models.reverse
11
11
  end
@@ -57,7 +57,6 @@ describe "route_to" do
57
57
  context "with should" do
58
58
  context "when assert_recognizes passes" do
59
59
  it "passes" do
60
- self.stub!(:assert_recognizes)
61
60
  expect do
62
61
  {:get => "path"}.should route_to("these" => "options")
63
62
  end.to_not raise_exception
@@ -66,7 +65,7 @@ describe "route_to" do
66
65
 
67
66
  context "when assert_recognizes fails with an assertion failure" do
68
67
  it "fails with message from assert_recognizes" do
69
- self.stub!(:assert_recognizes) do
68
+ def assert_recognizes(*)
70
69
  raise ActiveSupport::TestCase::Assertion.new("this message")
71
70
  end
72
71
  expect do
@@ -77,7 +76,7 @@ describe "route_to" do
77
76
 
78
77
  context "when assert_recognizes fails with a routing error" do
79
78
  it "fails with message from assert_recognizes" do
80
- self.stub!(:assert_recognizes) do
79
+ def assert_recognizes(*)
81
80
  raise ActionController::RoutingError.new("this message")
82
81
  end
83
82
  expect do
@@ -88,7 +87,7 @@ describe "route_to" do
88
87
 
89
88
  context "when an exception is raised" do
90
89
  it "raises that exception" do
91
- self.stub!(:assert_recognizes) do
90
+ def assert_recognizes(*)
92
91
  raise "oops"
93
92
  end
94
93
  expect do
@@ -101,7 +100,6 @@ describe "route_to" do
101
100
  context "with should_not" do
102
101
  context "when assert_recognizes passes" do
103
102
  it "fails with custom message" do
104
- self.stub!(:assert_recognizes)
105
103
  expect do
106
104
  {:get => "path"}.should_not route_to("these" => "options")
107
105
  end.to raise_error(/expected .* not to route to .*/)
@@ -110,7 +108,7 @@ describe "route_to" do
110
108
 
111
109
  context "when assert_recognizes fails with an assertion failure" do
112
110
  it "passes" do
113
- self.stub!(:assert_recognizes) do
111
+ def assert_recognizes(*)
114
112
  raise ActiveSupport::TestCase::Assertion.new("this message")
115
113
  end
116
114
  expect do
@@ -121,7 +119,7 @@ describe "route_to" do
121
119
 
122
120
  context "when assert_recognizes fails with a routing error" do
123
121
  it "passes" do
124
- self.stub!(:assert_recognizes) do
122
+ def assert_recognizes(*)
125
123
  raise ActionController::RoutingError.new("this message")
126
124
  end
127
125
  expect do
@@ -132,7 +130,7 @@ describe "route_to" do
132
130
 
133
131
  context "when an exception is raised" do
134
132
  it "raises that exception" do
135
- self.stub!(:assert_recognizes) do
133
+ def assert_recognizes(*)
136
134
  raise "oops"
137
135
  end
138
136
  expect do
@@ -143,8 +141,9 @@ describe "route_to" do
143
141
  end
144
142
 
145
143
  it "uses failure message from assert_recognizes" do
146
- self.stub!(:assert_recognizes).and_raise(
147
- ActiveSupport::TestCase::Assertion.new("this message"))
144
+ def assert_recognizes(*)
145
+ raise ActiveSupport::TestCase::Assertion, "this message"
146
+ end
148
147
  expect do
149
148
  {"this" => "path"}.should route_to("these" => "options")
150
149
  end.to raise_error("this message")
@@ -0,0 +1,22 @@
1
+ require "spec_helper"
2
+
3
+ describe RSpec::Rails::MiniTestLifecycleAdapter do
4
+ it "invokes minitest lifecycle hooks at the appropriate times" do
5
+ invocations = []
6
+ example_group = RSpec::Core::ExampleGroup.describe("MiniTestHooks") do
7
+ include RSpec::Rails::MiniTestLifecycleAdapter
8
+
9
+ define_method(:before_setup) { invocations << :before_setup }
10
+ define_method(:after_setup) { invocations << :after_setup }
11
+ define_method(:before_teardown) { invocations << :before_teardown }
12
+ define_method(:after_teardown) { invocations << :after_teardown }
13
+ end
14
+
15
+ example = example_group.example("foo") { invocations << :example }
16
+ example_group.run(NullObject.new)
17
+
18
+ expect(invocations).to eq([
19
+ :before_setup, :after_setup, :example, :before_teardown, :after_teardown
20
+ ])
21
+ end
22
+ end
@@ -0,0 +1,29 @@
1
+ require "spec_helper"
2
+
3
+ describe RSpec::Rails, "version" do
4
+ def clear_memoized_version
5
+ if RSpec::Rails.instance_variable_defined?(:@rails_version)
6
+ RSpec::Rails.send(:remove_instance_variable, :@rails_version)
7
+ end
8
+ end
9
+
10
+ before { clear_memoized_version }
11
+ after { clear_memoized_version }
12
+
13
+ describe "#rails_version_satisfied_by?" do
14
+ it "checks whether the gem version constraint is satisfied by the Rails version" do
15
+ ::Rails.stub(:version).and_return(Gem::Version.new("4.0.0"))
16
+
17
+ expect(RSpec::Rails.rails_version_satisfied_by?(">=3.2.0")).to be_true
18
+ expect(RSpec::Rails.rails_version_satisfied_by?("~>4.0.0")).to be_true
19
+ expect(RSpec::Rails.rails_version_satisfied_by?("~>3.2.0")).to be_false
20
+ end
21
+
22
+ it "operates correctly when the Rails version is a string (pre-Rails 4.0)" do
23
+ ::Rails.stub(:version).and_return("3.2.1")
24
+
25
+ expect(RSpec::Rails.rails_version_satisfied_by?("~>3.2.0")).to be_true
26
+ expect(RSpec::Rails.rails_version_satisfied_by?("~>3.1.0")).to be_false
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,6 @@
1
+ class NullObject
2
+ private
3
+
4
+ def method_missing(method, *args, &blk)
5
+ end
6
+ end
metadata CHANGED
@@ -1,208 +1,183 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-rails
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 2.13.0
4
+ version: 2.13.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - David Chelimsky
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-23 00:00:00.000000000 Z
11
+ date: 2013-04-27 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ! '>='
18
- - !ruby/object:Gem::Version
19
- version: '3.0'
20
- none: false
21
- prerelease: false
22
14
  name: activesupport
23
15
  requirement: !ruby/object:Gem::Requirement
24
16
  requirements:
25
- - - ! '>='
17
+ - - '>='
26
18
  - !ruby/object:Gem::Version
27
19
  version: '3.0'
28
- none: false
29
20
  type: :runtime
30
- - !ruby/object:Gem::Dependency
21
+ prerelease: false
31
22
  version_requirements: !ruby/object:Gem::Requirement
32
23
  requirements:
33
- - - ! '>='
24
+ - - '>='
34
25
  - !ruby/object:Gem::Version
35
26
  version: '3.0'
36
- none: false
37
- prerelease: false
27
+ - !ruby/object:Gem::Dependency
38
28
  name: actionpack
39
29
  requirement: !ruby/object:Gem::Requirement
40
30
  requirements:
41
- - - ! '>='
31
+ - - '>='
42
32
  - !ruby/object:Gem::Version
43
33
  version: '3.0'
44
- none: false
45
34
  type: :runtime
46
- - !ruby/object:Gem::Dependency
35
+ prerelease: false
47
36
  version_requirements: !ruby/object:Gem::Requirement
48
37
  requirements:
49
- - - ! '>='
38
+ - - '>='
50
39
  - !ruby/object:Gem::Version
51
40
  version: '3.0'
52
- none: false
53
- prerelease: false
41
+ - !ruby/object:Gem::Dependency
54
42
  name: railties
55
43
  requirement: !ruby/object:Gem::Requirement
56
44
  requirements:
57
- - - ! '>='
45
+ - - '>='
58
46
  - !ruby/object:Gem::Version
59
47
  version: '3.0'
60
- none: false
61
48
  type: :runtime
62
- - !ruby/object:Gem::Dependency
49
+ prerelease: false
63
50
  version_requirements: !ruby/object:Gem::Requirement
64
51
  requirements:
65
- - - ~>
52
+ - - '>='
66
53
  - !ruby/object:Gem::Version
67
- version: 2.13.0
68
- none: false
69
- prerelease: false
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
70
56
  name: rspec-core
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - ~>
74
60
  - !ruby/object:Gem::Version
75
61
  version: 2.13.0
76
- none: false
77
62
  type: :runtime
78
- - !ruby/object:Gem::Dependency
63
+ prerelease: false
79
64
  version_requirements: !ruby/object:Gem::Requirement
80
65
  requirements:
81
66
  - - ~>
82
67
  - !ruby/object:Gem::Version
83
68
  version: 2.13.0
84
- none: false
85
- prerelease: false
69
+ - !ruby/object:Gem::Dependency
86
70
  name: rspec-expectations
87
71
  requirement: !ruby/object:Gem::Requirement
88
72
  requirements:
89
73
  - - ~>
90
74
  - !ruby/object:Gem::Version
91
75
  version: 2.13.0
92
- none: false
93
76
  type: :runtime
94
- - !ruby/object:Gem::Dependency
77
+ prerelease: false
95
78
  version_requirements: !ruby/object:Gem::Requirement
96
79
  requirements:
97
80
  - - ~>
98
81
  - !ruby/object:Gem::Version
99
82
  version: 2.13.0
100
- none: false
101
- prerelease: false
83
+ - !ruby/object:Gem::Dependency
102
84
  name: rspec-mocks
103
85
  requirement: !ruby/object:Gem::Requirement
104
86
  requirements:
105
87
  - - ~>
106
88
  - !ruby/object:Gem::Version
107
89
  version: 2.13.0
108
- none: false
109
90
  type: :runtime
110
- - !ruby/object:Gem::Dependency
91
+ prerelease: false
111
92
  version_requirements: !ruby/object:Gem::Requirement
112
93
  requirements:
113
94
  - - ~>
114
95
  - !ruby/object:Gem::Version
115
- version: 10.0.0
116
- none: false
117
- prerelease: false
96
+ version: 2.13.0
97
+ - !ruby/object:Gem::Dependency
118
98
  name: rake
119
99
  requirement: !ruby/object:Gem::Requirement
120
100
  requirements:
121
101
  - - ~>
122
102
  - !ruby/object:Gem::Version
123
103
  version: 10.0.0
124
- none: false
125
104
  type: :development
126
- - !ruby/object:Gem::Dependency
105
+ prerelease: false
127
106
  version_requirements: !ruby/object:Gem::Requirement
128
107
  requirements:
129
108
  - - ~>
130
109
  - !ruby/object:Gem::Version
131
- version: 1.1.9
132
- none: false
133
- prerelease: false
110
+ version: 10.0.0
111
+ - !ruby/object:Gem::Dependency
134
112
  name: cucumber
135
113
  requirement: !ruby/object:Gem::Requirement
136
114
  requirements:
137
115
  - - ~>
138
116
  - !ruby/object:Gem::Version
139
117
  version: 1.1.9
140
- none: false
141
118
  type: :development
142
- - !ruby/object:Gem::Dependency
119
+ prerelease: false
143
120
  version_requirements: !ruby/object:Gem::Requirement
144
121
  requirements:
145
122
  - - ~>
146
123
  - !ruby/object:Gem::Version
147
- version: 0.4.11
148
- none: false
149
- prerelease: false
124
+ version: 1.1.9
125
+ - !ruby/object:Gem::Dependency
150
126
  name: aruba
151
127
  requirement: !ruby/object:Gem::Requirement
152
128
  requirements:
153
129
  - - ~>
154
130
  - !ruby/object:Gem::Version
155
131
  version: 0.4.11
156
- none: false
157
132
  type: :development
158
- - !ruby/object:Gem::Dependency
133
+ prerelease: false
159
134
  version_requirements: !ruby/object:Gem::Requirement
160
135
  requirements:
161
- - - '='
136
+ - - ~>
162
137
  - !ruby/object:Gem::Version
163
- version: 4.6.2
164
- none: false
165
- prerelease: false
138
+ version: 0.4.11
139
+ - !ruby/object:Gem::Dependency
166
140
  name: ZenTest
167
141
  requirement: !ruby/object:Gem::Requirement
168
142
  requirements:
169
143
  - - '='
170
144
  - !ruby/object:Gem::Version
171
- version: 4.6.2
172
- none: false
145
+ version: 4.9.0
173
146
  type: :development
174
- - !ruby/object:Gem::Dependency
147
+ prerelease: false
175
148
  version_requirements: !ruby/object:Gem::Requirement
176
149
  requirements:
177
150
  - - '='
178
151
  - !ruby/object:Gem::Version
179
- version: 0.2.5
180
- none: false
181
- prerelease: false
152
+ version: 4.9.0
153
+ - !ruby/object:Gem::Dependency
182
154
  name: ammeter
183
155
  requirement: !ruby/object:Gem::Requirement
184
156
  requirements:
185
157
  - - '='
186
158
  - !ruby/object:Gem::Version
187
159
  version: 0.2.5
188
- none: false
189
160
  type: :development
190
- - !ruby/object:Gem::Dependency
161
+ prerelease: false
191
162
  version_requirements: !ruby/object:Gem::Requirement
192
163
  requirements:
193
- - - ! '>='
164
+ - - '='
194
165
  - !ruby/object:Gem::Version
195
- version: 2.0.0.beta4
196
- none: false
197
- prerelease: false
166
+ version: 0.2.5
167
+ - !ruby/object:Gem::Dependency
198
168
  name: capybara
199
169
  requirement: !ruby/object:Gem::Requirement
200
170
  requirements:
201
- - - ! '>='
171
+ - - '>='
202
172
  - !ruby/object:Gem::Version
203
- version: 2.0.0.beta4
204
- none: false
173
+ version: 2.0.0
205
174
  type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - '>='
179
+ - !ruby/object:Gem::Version
180
+ version: 2.0.0
206
181
  description: RSpec for Rails
207
182
  email: rspec-users@rubyforge.org
208
183
  executables: []
@@ -266,6 +241,7 @@ files:
266
241
  - lib/rspec/rails/matchers/routing_matchers.rb
267
242
  - lib/rspec/rails/mocks.rb
268
243
  - lib/rspec/rails/module_inclusion.rb
244
+ - lib/rspec/rails/rails_version.rb
269
245
  - lib/rspec/rails/tasks/rspec.rake
270
246
  - lib/rspec/rails/vendor/capybara.rb
271
247
  - lib/rspec/rails/vendor/webrat.rb
@@ -290,6 +266,7 @@ files:
290
266
  - features/controller_specs/anonymous_controller.feature
291
267
  - features/controller_specs/bypass_rescue.feature
292
268
  - features/controller_specs/controller_spec.feature
269
+ - features/controller_specs/engine_routes.feature
293
270
  - features/controller_specs/isolation_from_views.feature
294
271
  - features/controller_specs/render_views.feature
295
272
  - features/feature_specs/feature_spec.feature
@@ -308,11 +285,13 @@ files:
308
285
  - features/request_specs/request_spec.feature
309
286
  - features/routing_specs/README.md
310
287
  - features/routing_specs/be_routable_matcher.feature
288
+ - features/routing_specs/engine_routes.feature
311
289
  - features/routing_specs/named_routes.feature
312
290
  - features/routing_specs/route_to_matcher.feature
313
291
  - features/step_definitions/additional_cli_steps.rb
314
292
  - features/step_definitions/model_steps.rb
315
293
  - features/support/env.rb
294
+ - features/support/rails_versions.rb
316
295
  - features/view_specs/inferred_controller_path.feature
317
296
  - features/view_specs/stub_template.feature
318
297
  - features/view_specs/view_spec.feature
@@ -352,17 +331,21 @@ files:
352
331
  - spec/rspec/rails/matchers/redirect_to_spec.rb
353
332
  - spec/rspec/rails/matchers/relation_match_array_spec.rb
354
333
  - spec/rspec/rails/matchers/route_to_spec.rb
334
+ - spec/rspec/rails/minitest_lifecycle_adapter_spec.rb
355
335
  - spec/rspec/rails/mocks/mock_model_spec.rb
356
336
  - spec/rspec/rails/mocks/stub_model_spec.rb
337
+ - spec/rspec/rails/rails_version_spec.rb
357
338
  - spec/rspec/rails/setup_and_teardown_adapter_spec.rb
358
339
  - spec/rspec/rails/view_rendering_spec.rb
359
340
  - spec/spec_helper.rb
360
341
  - spec/support/ar_classes.rb
361
342
  - spec/support/helpers.rb
362
343
  - spec/support/matchers.rb
344
+ - spec/support/null_object.rb
363
345
  homepage: http://github.com/rspec/rspec-rails
364
346
  licenses:
365
347
  - MIT
348
+ metadata: {}
366
349
  post_install_message:
367
350
  rdoc_options:
368
351
  - --charset=UTF-8
@@ -370,28 +353,20 @@ require_paths:
370
353
  - lib
371
354
  required_ruby_version: !ruby/object:Gem::Requirement
372
355
  requirements:
373
- - - ! '>='
356
+ - - '>='
374
357
  - !ruby/object:Gem::Version
375
358
  version: '0'
376
- segments:
377
- - 0
378
- hash: 643908547844668422
379
- none: false
380
359
  required_rubygems_version: !ruby/object:Gem::Requirement
381
360
  requirements:
382
- - - ! '>='
361
+ - - '>='
383
362
  - !ruby/object:Gem::Version
384
363
  version: '0'
385
- segments:
386
- - 0
387
- hash: 643908547844668422
388
- none: false
389
364
  requirements: []
390
365
  rubyforge_project: rspec
391
- rubygems_version: 1.8.24
366
+ rubygems_version: 2.0.2
392
367
  signing_key:
393
- specification_version: 3
394
- summary: rspec-rails-2.13.0
368
+ specification_version: 4
369
+ summary: rspec-rails-2.13.1
395
370
  test_files:
396
371
  - features/Autotest.md
397
372
  - features/Generators.md
@@ -405,6 +380,7 @@ test_files:
405
380
  - features/controller_specs/anonymous_controller.feature
406
381
  - features/controller_specs/bypass_rescue.feature
407
382
  - features/controller_specs/controller_spec.feature
383
+ - features/controller_specs/engine_routes.feature
408
384
  - features/controller_specs/isolation_from_views.feature
409
385
  - features/controller_specs/render_views.feature
410
386
  - features/feature_specs/feature_spec.feature
@@ -423,11 +399,13 @@ test_files:
423
399
  - features/request_specs/request_spec.feature
424
400
  - features/routing_specs/README.md
425
401
  - features/routing_specs/be_routable_matcher.feature
402
+ - features/routing_specs/engine_routes.feature
426
403
  - features/routing_specs/named_routes.feature
427
404
  - features/routing_specs/route_to_matcher.feature
428
405
  - features/step_definitions/additional_cli_steps.rb
429
406
  - features/step_definitions/model_steps.rb
430
407
  - features/support/env.rb
408
+ - features/support/rails_versions.rb
431
409
  - features/view_specs/inferred_controller_path.feature
432
410
  - features/view_specs/stub_template.feature
433
411
  - features/view_specs/view_spec.feature
@@ -467,12 +445,15 @@ test_files:
467
445
  - spec/rspec/rails/matchers/redirect_to_spec.rb
468
446
  - spec/rspec/rails/matchers/relation_match_array_spec.rb
469
447
  - spec/rspec/rails/matchers/route_to_spec.rb
448
+ - spec/rspec/rails/minitest_lifecycle_adapter_spec.rb
470
449
  - spec/rspec/rails/mocks/mock_model_spec.rb
471
450
  - spec/rspec/rails/mocks/stub_model_spec.rb
451
+ - spec/rspec/rails/rails_version_spec.rb
472
452
  - spec/rspec/rails/setup_and_teardown_adapter_spec.rb
473
453
  - spec/rspec/rails/view_rendering_spec.rb
474
454
  - spec/spec_helper.rb
475
455
  - spec/support/ar_classes.rb
476
456
  - spec/support/helpers.rb
477
457
  - spec/support/matchers.rb
458
+ - spec/support/null_object.rb
478
459
  has_rdoc: