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
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class CollectionOwner < ActiveRecord::Base
|
4
|
+
connection.execute <<-SQL
|
5
|
+
CREATE TABLE collection_owners (
|
6
|
+
id integer PRIMARY KEY AUTOINCREMENT
|
7
|
+
)
|
8
|
+
SQL
|
9
|
+
has_many :associated_items do
|
10
|
+
def has_some_quality?; true end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class AssociatedItem < ActiveRecord::Base
|
15
|
+
connection.execute <<-SQL
|
16
|
+
CREATE TABLE associated_items (
|
17
|
+
id integer PRIMARY KEY AUTOINCREMENT,
|
18
|
+
collection_owner_id integer
|
19
|
+
)
|
20
|
+
SQL
|
21
|
+
belongs_to :collection_owner
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "should have_xxx" do
|
25
|
+
it "works with ActiveRecord::Associations::CollectionProxy" do
|
26
|
+
owner = CollectionOwner.new
|
27
|
+
owner.associated_items.should have_some_quality
|
28
|
+
end
|
29
|
+
end
|
@@ -2,16 +2,27 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe "ActiveSupport::Relation =~ matcher" do
|
4
4
|
before { MockableModel.delete_all }
|
5
|
-
|
5
|
+
|
6
6
|
let!(:models) { Array.new(3) { MockableModel.create } }
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
if Rails.version >= '4'
|
9
|
+
it "verifies that the scope returns the records on the right hand side, regardless of order" do
|
10
|
+
MockableModel.all.should =~ models.reverse
|
11
|
+
end
|
12
|
+
|
13
|
+
it "fails if the scope encompasses more records than on the right hand side" do
|
14
|
+
MockableModel.create
|
15
|
+
MockableModel.all.should_not =~ models.reverse
|
16
|
+
end
|
17
|
+
else
|
18
|
+
it "verifies that the scope returns the records on the right hand side, regardless of order" do
|
19
|
+
MockableModel.scoped.should =~ models.reverse
|
20
|
+
end
|
11
21
|
|
12
|
-
|
13
|
-
|
14
|
-
|
22
|
+
it "fails if the scope encompasses more records than on the right hand side" do
|
23
|
+
MockableModel.create
|
24
|
+
MockableModel.scoped.should_not =~ models.reverse
|
25
|
+
end
|
15
26
|
end
|
16
27
|
|
17
28
|
it "fails if the scope encompasses fewer records than on the right hand side" do
|
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: 2.
|
4
|
+
version: 2.12.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -60,13 +60,13 @@ dependencies:
|
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '3.0'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name: rspec
|
63
|
+
name: rspec-core
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 2.
|
69
|
+
version: 2.12.0
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,7 +74,39 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 2.
|
77
|
+
version: 2.12.0
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rspec-expectations
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 2.12.0
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 2.12.0
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rspec-mocks
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 2.12.0
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.12.0
|
78
110
|
- !ruby/object:Gem::Dependency
|
79
111
|
name: rake
|
80
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,7 +114,7 @@ dependencies:
|
|
82
114
|
requirements:
|
83
115
|
- - ~>
|
84
116
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0.
|
117
|
+
version: 10.0.0
|
86
118
|
type: :development
|
87
119
|
prerelease: false
|
88
120
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +122,7 @@ dependencies:
|
|
90
122
|
requirements:
|
91
123
|
- - ~>
|
92
124
|
- !ruby/object:Gem::Version
|
93
|
-
version: 0.
|
125
|
+
version: 10.0.0
|
94
126
|
- !ruby/object:Gem::Dependency
|
95
127
|
name: cucumber
|
96
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -155,6 +187,22 @@ dependencies:
|
|
155
187
|
- - '='
|
156
188
|
- !ruby/object:Gem::Version
|
157
189
|
version: 0.2.5
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: capybara
|
192
|
+
requirement: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ! '>='
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: 2.0.0.beta4
|
198
|
+
type: :development
|
199
|
+
prerelease: false
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
202
|
+
requirements:
|
203
|
+
- - ! '>='
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: 2.0.0.beta4
|
158
206
|
description: RSpec for Rails
|
159
207
|
email: rspec-users@rubyforge.org
|
160
208
|
executables: []
|
@@ -195,6 +243,7 @@ files:
|
|
195
243
|
- lib/rspec/rails/adapters.rb
|
196
244
|
- lib/rspec/rails/example.rb
|
197
245
|
- lib/rspec/rails/example/controller_example_group.rb
|
246
|
+
- lib/rspec/rails/example/feature_example_group.rb
|
198
247
|
- lib/rspec/rails/example/helper_example_group.rb
|
199
248
|
- lib/rspec/rails/example/mailer_example_group.rb
|
200
249
|
- lib/rspec/rails/example/model_example_group.rb
|
@@ -204,6 +253,7 @@ files:
|
|
204
253
|
- lib/rspec/rails/example/view_example_group.rb
|
205
254
|
- lib/rspec/rails/extensions.rb
|
206
255
|
- lib/rspec/rails/extensions/active_record/base.rb
|
256
|
+
- lib/rspec/rails/extensions/active_record/proxy.rb
|
207
257
|
- lib/rspec/rails/fixture_support.rb
|
208
258
|
- lib/rspec/rails/matchers.rb
|
209
259
|
- lib/rspec/rails/matchers/be_a_new.rb
|
@@ -241,6 +291,7 @@ files:
|
|
241
291
|
- features/controller_specs/controller_spec.feature
|
242
292
|
- features/controller_specs/isolation_from_views.feature
|
243
293
|
- features/controller_specs/render_views.feature
|
294
|
+
- features/feature_specs/feature_spec.feature
|
244
295
|
- features/helper_specs/helper_spec.feature
|
245
296
|
- features/mailer_specs/url_helpers.feature
|
246
297
|
- features/matchers/README.md
|
@@ -278,6 +329,7 @@ files:
|
|
278
329
|
- spec/rspec/rails/configuration_spec.rb
|
279
330
|
- spec/rspec/rails/deprecations_spec.rb
|
280
331
|
- spec/rspec/rails/example/controller_example_group_spec.rb
|
332
|
+
- spec/rspec/rails/example/feature_example_group_spec.rb
|
281
333
|
- spec/rspec/rails/example/helper_example_group_spec.rb
|
282
334
|
- spec/rspec/rails/example/mailer_example_group_spec.rb
|
283
335
|
- spec/rspec/rails/example/model_example_group_spec.rb
|
@@ -291,6 +343,7 @@ files:
|
|
291
343
|
- spec/rspec/rails/matchers/be_new_record_spec.rb
|
292
344
|
- spec/rspec/rails/matchers/be_routable_spec.rb
|
293
345
|
- spec/rspec/rails/matchers/errors_on_spec.rb
|
346
|
+
- spec/rspec/rails/matchers/has_spec.rb
|
294
347
|
- spec/rspec/rails/matchers/have_rendered_spec.rb
|
295
348
|
- spec/rspec/rails/matchers/redirect_to_spec.rb
|
296
349
|
- spec/rspec/rails/matchers/relation_match_array_spec.rb
|
@@ -319,7 +372,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
319
372
|
version: '0'
|
320
373
|
segments:
|
321
374
|
- 0
|
322
|
-
hash:
|
375
|
+
hash: 1102078046933172759
|
323
376
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
324
377
|
none: false
|
325
378
|
requirements:
|
@@ -328,13 +381,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
328
381
|
version: '0'
|
329
382
|
segments:
|
330
383
|
- 0
|
331
|
-
hash:
|
384
|
+
hash: 1102078046933172759
|
332
385
|
requirements: []
|
333
386
|
rubyforge_project: rspec
|
334
387
|
rubygems_version: 1.8.24
|
335
388
|
signing_key:
|
336
389
|
specification_version: 3
|
337
|
-
summary: rspec-rails-2.
|
390
|
+
summary: rspec-rails-2.12.0
|
338
391
|
test_files:
|
339
392
|
- features/Autotest.md
|
340
393
|
- features/Generators.md
|
@@ -350,6 +403,7 @@ test_files:
|
|
350
403
|
- features/controller_specs/controller_spec.feature
|
351
404
|
- features/controller_specs/isolation_from_views.feature
|
352
405
|
- features/controller_specs/render_views.feature
|
406
|
+
- features/feature_specs/feature_spec.feature
|
353
407
|
- features/helper_specs/helper_spec.feature
|
354
408
|
- features/mailer_specs/url_helpers.feature
|
355
409
|
- features/matchers/README.md
|
@@ -387,6 +441,7 @@ test_files:
|
|
387
441
|
- spec/rspec/rails/configuration_spec.rb
|
388
442
|
- spec/rspec/rails/deprecations_spec.rb
|
389
443
|
- spec/rspec/rails/example/controller_example_group_spec.rb
|
444
|
+
- spec/rspec/rails/example/feature_example_group_spec.rb
|
390
445
|
- spec/rspec/rails/example/helper_example_group_spec.rb
|
391
446
|
- spec/rspec/rails/example/mailer_example_group_spec.rb
|
392
447
|
- spec/rspec/rails/example/model_example_group_spec.rb
|
@@ -400,6 +455,7 @@ test_files:
|
|
400
455
|
- spec/rspec/rails/matchers/be_new_record_spec.rb
|
401
456
|
- spec/rspec/rails/matchers/be_routable_spec.rb
|
402
457
|
- spec/rspec/rails/matchers/errors_on_spec.rb
|
458
|
+
- spec/rspec/rails/matchers/has_spec.rb
|
403
459
|
- spec/rspec/rails/matchers/have_rendered_spec.rb
|
404
460
|
- spec/rspec/rails/matchers/redirect_to_spec.rb
|
405
461
|
- spec/rspec/rails/matchers/relation_match_array_spec.rb
|