rspec-rails 2.4.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +8 -0
- data/features/README.md +1 -1
- data/features/controller_specs/README.md +4 -4
- data/features/controller_specs/render_views.feature +2 -2
- data/features/helper_specs/helper_spec.feature +3 -2
- data/features/matchers/new_record_matcher.feature +4 -4
- data/features/matchers/redirect_to_matcher.feature +4 -5
- data/features/model_specs/README.md +6 -4
- data/lib/rspec/rails/example/controller_example_group.rb +1 -2
- data/lib/rspec/rails/example/helper_example_group.rb +1 -2
- data/lib/rspec/rails/example/mailer_example_group.rb +1 -2
- data/lib/rspec/rails/example/model_example_group.rb +0 -1
- data/lib/rspec/rails/example/rails_example_group.rb +0 -1
- data/lib/rspec/rails/example/request_example_group.rb +1 -2
- data/lib/rspec/rails/example/routing_example_group.rb +1 -2
- data/lib/rspec/rails/example/view_example_group.rb +1 -2
- data/lib/rspec/rails/version.rb +1 -1
- metadata +17 -12
data/History.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
## rspec-rails-2 release history
|
2
2
|
|
3
|
+
### 2.4.1 / 2011-01-03
|
4
|
+
|
5
|
+
[full changelog](http://github.com/rspec/rspec-rails/compare/v2.4.0...2.4.1)
|
6
|
+
|
7
|
+
* Bug fixes
|
8
|
+
* fixed bug caused by including some Rails modules before RSpec's
|
9
|
+
RailsExampleGroup
|
10
|
+
|
3
11
|
### 2.4.0 / 2011-01-02
|
4
12
|
|
5
13
|
[full changelog](http://github.com/rspec/rspec-rails/compare/v2.3.1...2.4.0)
|
data/features/README.md
CHANGED
@@ -23,7 +23,7 @@ This installs the following gems:
|
|
23
23
|
Add rspec-rails to the :test and :development groups in the Gemfile:
|
24
24
|
|
25
25
|
group :test, :development do
|
26
|
-
gem "rspec-rails", "~> 2.
|
26
|
+
gem "rspec-rails", "~> 2.4"
|
27
27
|
end
|
28
28
|
|
29
29
|
It needs to be in the :development group to expose generators and rake tasks
|
@@ -5,10 +5,10 @@ A controller spec is an RSpec wrapper for a Rails functional test
|
|
5
5
|
(ActionController::TestCase::Behavior). It allows you to simulate a single
|
6
6
|
http request in each example, and then specify expected outcomes, including:
|
7
7
|
|
8
|
-
*
|
9
|
-
*
|
10
|
-
|
11
|
-
* cookies
|
8
|
+
* rendered templates
|
9
|
+
* redirects
|
10
|
+
* instance variables assigned in the controller to be shared with the view
|
11
|
+
* cookies sent back with the response
|
12
12
|
|
13
13
|
To specify outcomes, you can use:
|
14
14
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Feature: render_views
|
2
2
|
|
3
|
-
You can tell a controller example group to render views with the
|
4
|
-
declaration.
|
3
|
+
You can tell a controller example group to render views with the
|
4
|
+
`render_views` declaration.
|
5
5
|
|
6
6
|
Scenario: expect template that exists and is rendered by controller (passes)
|
7
7
|
Given a file named "spec/controllers/widgets_controller_spec.rb" with:
|
@@ -1,7 +1,8 @@
|
|
1
1
|
Feature: helper spec
|
2
2
|
|
3
|
-
Helper specs live in `spec/helpers
|
4
|
-
you can call them on the
|
3
|
+
Helper specs live in `spec/helpers`, or any example group with `:type =>
|
4
|
+
:helper`. In order to access the helper methods you can call them on the
|
5
|
+
`helper` object.
|
5
6
|
|
6
7
|
Scenario: helper method that returns true
|
7
8
|
Given a file named "spec/helpers/application_helper_spec.rb" with:
|
@@ -1,10 +1,10 @@
|
|
1
1
|
Feature: be_a_new matcher
|
2
2
|
|
3
|
-
The be_a_new matcher accepts a class and passes if the subject is an
|
4
|
-
of that class that returns
|
3
|
+
The `be_a_new` matcher accepts a class and passes if the subject is an
|
4
|
+
instance of that class that returns false to persisted?
|
5
5
|
|
6
|
-
You can also
|
7
|
-
subject has equal attributes.
|
6
|
+
You can also chain `with` on `be_a_new` with a hash of attributes to specify
|
7
|
+
the subject has equal attributes.
|
8
8
|
|
9
9
|
Scenario: example spec with four be_a_new possibilities
|
10
10
|
Given a file named "spec/models/widget_spec.rb" with:
|
@@ -1,9 +1,8 @@
|
|
1
1
|
Feature: redirect_to matcher
|
2
2
|
|
3
|
-
The redirect_to matcher is used to specify that the redirect called
|
4
|
-
|
5
|
-
|
6
|
-
the Rails documentation on this method.
|
3
|
+
The `redirect_to` matcher is used to specify that the redirect called in the
|
4
|
+
latest action ended with the intended behaviour. Essentially, it delegates to
|
5
|
+
[`assert_redirected_to`](http://api.rubyonrails.org/classes/ActionDispatch/Assertions/ResponseAssertions.html#method-i-assert_redirected_to).
|
7
6
|
|
8
7
|
It is available in controller specs (spec/controllers) and request
|
9
8
|
specs (spec/requests).
|
@@ -38,4 +37,4 @@ Feature: redirect_to matcher
|
|
38
37
|
end
|
39
38
|
"""
|
40
39
|
When I run "rspec spec/controllers/widgets_controller_spec.rb"
|
41
|
-
Then the output should contain "4 examples, 0 failures"
|
40
|
+
Then the output should contain "4 examples, 0 failures"
|
@@ -1,7 +1,9 @@
|
|
1
|
-
Model specs live in spec/models
|
2
|
-
|
3
|
-
|
4
|
-
and
|
1
|
+
Model specs live in `spec/models` or any example group with
|
2
|
+
`:type => :model`.
|
3
|
+
|
4
|
+
A model spec is a thin wrapper for an ActiveSupport::TestCase, and includes all
|
5
|
+
of the behavior and assertions that it provides, in addition to RSpec's own
|
6
|
+
behavior and expectations.
|
5
7
|
|
6
8
|
## Examples
|
7
9
|
|
@@ -72,9 +72,8 @@ module RSpec::Rails
|
|
72
72
|
#
|
73
73
|
module ControllerExampleGroup
|
74
74
|
extend ActiveSupport::Concern
|
75
|
-
|
76
|
-
include ActionController::TestCase::Behavior
|
77
75
|
include RSpec::Rails::RailsExampleGroup
|
76
|
+
include ActionController::TestCase::Behavior
|
78
77
|
include RSpec::Rails::ViewRendering
|
79
78
|
include RSpec::Rails::Matchers::RedirectTo
|
80
79
|
include RSpec::Rails::Matchers::RenderTemplate
|
@@ -27,9 +27,8 @@ module RSpec::Rails
|
|
27
27
|
#
|
28
28
|
module HelperExampleGroup
|
29
29
|
extend ActiveSupport::Concern
|
30
|
-
|
31
|
-
include ActionView::TestCase::Behavior
|
32
30
|
include RSpec::Rails::RailsExampleGroup
|
31
|
+
include ActionView::TestCase::Behavior
|
33
32
|
include RSpec::Rails::ViewAssigns
|
34
33
|
include RSpec::Rails::BrowserSimulators
|
35
34
|
|
@@ -2,9 +2,8 @@ if defined?(ActionMailer)
|
|
2
2
|
module RSpec::Rails
|
3
3
|
module MailerExampleGroup
|
4
4
|
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
include ActionMailer::TestCase::Behavior
|
7
5
|
include RSpec::Rails::RailsExampleGroup
|
6
|
+
include ActionMailer::TestCase::Behavior
|
8
7
|
include RSpec::Rails::BrowserSimulators
|
9
8
|
|
10
9
|
webrat do
|
@@ -13,10 +13,9 @@ module RSpec::Rails
|
|
13
13
|
# => delegates to assert_redirected_to(destination)
|
14
14
|
module RequestExampleGroup
|
15
15
|
extend ActiveSupport::Concern
|
16
|
-
|
16
|
+
include RSpec::Rails::RailsExampleGroup
|
17
17
|
include ActionDispatch::Integration::Runner
|
18
18
|
include ActionDispatch::Assertions
|
19
|
-
include RSpec::Rails::RailsExampleGroup
|
20
19
|
include RSpec::Rails::BrowserSimulators
|
21
20
|
|
22
21
|
module InstanceMethods
|
@@ -3,9 +3,8 @@ require "action_dispatch/testing/assertions/routing"
|
|
3
3
|
module RSpec::Rails
|
4
4
|
module RoutingExampleGroup
|
5
5
|
extend ActiveSupport::Concern
|
6
|
-
|
7
|
-
include ActionDispatch::Assertions::RoutingAssertions
|
8
6
|
include RSpec::Rails::RailsExampleGroup
|
7
|
+
include ActionDispatch::Assertions::RoutingAssertions
|
9
8
|
include RSpec::Rails::Matchers::RoutingMatchers
|
10
9
|
|
11
10
|
module InstanceMethods
|
@@ -19,9 +19,8 @@ module RSpec::Rails
|
|
19
19
|
# end
|
20
20
|
module ViewExampleGroup
|
21
21
|
extend ActiveSupport::Concern
|
22
|
-
|
23
|
-
include ActionView::TestCase::Behavior
|
24
22
|
include RSpec::Rails::RailsExampleGroup
|
23
|
+
include ActionView::TestCase::Behavior
|
25
24
|
include RSpec::Rails::ViewAssigns
|
26
25
|
include RSpec::Rails::Matchers::RenderTemplate
|
27
26
|
include RSpec::Rails::BrowserSimulators
|
data/lib/rspec/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 2
|
7
8
|
- 4
|
8
|
-
-
|
9
|
-
version: 2.4.
|
9
|
+
- 1
|
10
|
+
version: 2.4.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- David Chelimsky
|
@@ -14,64 +15,68 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-03 00:00:00 -06:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
|
-
name: activesupport
|
22
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
23
23
|
none: false
|
24
24
|
requirements:
|
25
25
|
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
+
hash: 7
|
27
28
|
segments:
|
28
29
|
- 3
|
29
30
|
- 0
|
30
31
|
version: "3.0"
|
31
32
|
type: :runtime
|
33
|
+
name: activesupport
|
32
34
|
prerelease: false
|
33
35
|
version_requirements: *id001
|
34
36
|
- !ruby/object:Gem::Dependency
|
35
|
-
name: actionpack
|
36
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
37
38
|
none: false
|
38
39
|
requirements:
|
39
40
|
- - ~>
|
40
41
|
- !ruby/object:Gem::Version
|
42
|
+
hash: 7
|
41
43
|
segments:
|
42
44
|
- 3
|
43
45
|
- 0
|
44
46
|
version: "3.0"
|
45
47
|
type: :runtime
|
48
|
+
name: actionpack
|
46
49
|
prerelease: false
|
47
50
|
version_requirements: *id002
|
48
51
|
- !ruby/object:Gem::Dependency
|
49
|
-
name: railties
|
50
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
51
53
|
none: false
|
52
54
|
requirements:
|
53
55
|
- - ~>
|
54
56
|
- !ruby/object:Gem::Version
|
57
|
+
hash: 7
|
55
58
|
segments:
|
56
59
|
- 3
|
57
60
|
- 0
|
58
61
|
version: "3.0"
|
59
62
|
type: :runtime
|
63
|
+
name: railties
|
60
64
|
prerelease: false
|
61
65
|
version_requirements: *id003
|
62
66
|
- !ruby/object:Gem::Dependency
|
63
|
-
name: rspec
|
64
67
|
requirement: &id004 !ruby/object:Gem::Requirement
|
65
68
|
none: false
|
66
69
|
requirements:
|
67
70
|
- - ~>
|
68
71
|
- !ruby/object:Gem::Version
|
72
|
+
hash: 31
|
69
73
|
segments:
|
70
74
|
- 2
|
71
75
|
- 4
|
72
76
|
- 0
|
73
77
|
version: 2.4.0
|
74
78
|
type: :runtime
|
79
|
+
name: rspec
|
75
80
|
prerelease: false
|
76
81
|
version_requirements: *id004
|
77
82
|
description: RSpec-2 for Rails-3
|
@@ -223,7 +228,7 @@ licenses: []
|
|
223
228
|
post_install_message: |
|
224
229
|
**************************************************
|
225
230
|
|
226
|
-
Thank you for installing rspec-rails-2.4.
|
231
|
+
Thank you for installing rspec-rails-2.4.1!
|
227
232
|
|
228
233
|
This version of rspec-rails only works with versions of rails >= 3.0.0
|
229
234
|
|
@@ -233,7 +238,7 @@ post_install_message: |
|
|
233
238
|
can access its generators and rake tasks.
|
234
239
|
|
235
240
|
group :development, :test do
|
236
|
-
gem "rspec-rails", ">= 2.4.
|
241
|
+
gem "rspec-rails", ">= 2.4.1"
|
237
242
|
end
|
238
243
|
|
239
244
|
Be sure to run the following command in each of your Rails apps if you're
|
@@ -264,7 +269,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
264
269
|
requirements:
|
265
270
|
- - ">="
|
266
271
|
- !ruby/object:Gem::Version
|
267
|
-
hash:
|
272
|
+
hash: 3
|
268
273
|
segments:
|
269
274
|
- 0
|
270
275
|
version: "0"
|
@@ -273,7 +278,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
273
278
|
requirements:
|
274
279
|
- - ">="
|
275
280
|
- !ruby/object:Gem::Version
|
276
|
-
hash:
|
281
|
+
hash: 3
|
277
282
|
segments:
|
278
283
|
- 0
|
279
284
|
version: "0"
|
@@ -283,7 +288,7 @@ rubyforge_project: rspec
|
|
283
288
|
rubygems_version: 1.3.7
|
284
289
|
signing_key:
|
285
290
|
specification_version: 3
|
286
|
-
summary: rspec-rails-2.4.
|
291
|
+
summary: rspec-rails-2.4.1
|
287
292
|
test_files:
|
288
293
|
- features/Autotest.md
|
289
294
|
- features/Generators.md
|