rspec-rails 2.0.0.beta.13 → 2.0.0.beta.14.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +75 -54
- data/Rakefile +5 -2
- data/Upgrade.markdown +13 -13
- data/VERSION +1 -1
- data/features/controller_specs/{do_not_render_views.feature → isolation_from_views.feature} +12 -11
- data/features/controller_specs/render_views.feature +8 -8
- data/features/{routing_specs → matchers}/be_routable_matcher.feature +18 -2
- data/lib/generators/rspec/install/templates/spec/spec_helper.rb +2 -2
- data/lib/generators/rspec/scaffold/scaffold_generator.rb +9 -0
- data/lib/generators/rspec/scaffold/templates/controller_spec.rb +1 -1
- data/lib/generators/rspec/scaffold/templates/index_spec.rb +2 -2
- data/lib/generators/rspec/scaffold/templates/show_spec.rb +2 -2
- data/lib/rspec/rails.rb +3 -0
- data/lib/rspec/rails/example/controller_example_group.rb +5 -8
- data/lib/rspec/rails/example/helper_example_group.rb +3 -6
- data/lib/rspec/rails/example/mailer_example_group.rb +2 -7
- data/lib/rspec/rails/example/request_example_group.rb +2 -6
- data/lib/rspec/rails/example/routing_example_group.rb +3 -4
- data/lib/rspec/rails/example/view_example_group.rb +3 -6
- data/lib/rspec/rails/matchers.rb +1 -11
- data/lib/rspec/rails/matchers/{routing_spec_matchers.rb → routing_matchers.rb} +2 -2
- data/lib/rspec/rails/mocks.rb +11 -1
- data/lib/rspec/rails/module_inclusion.rb +11 -0
- data/lib/rspec/rails/monkey/action_mailer/test_case.rb +48 -48
- data/lib/rspec/rails/view_rendering.rb +30 -6
- data/rspec-rails.gemspec +16 -12
- data/spec/rspec/rails/example/controller_example_group_spec.rb +8 -6
- data/spec/rspec/rails/example/helper_example_group_spec.rb +3 -7
- data/spec/rspec/rails/example/mailer_example_group_spec.rb +2 -7
- data/spec/rspec/rails/example/request_example_group_spec.rb +2 -7
- data/spec/rspec/rails/example/routing_example_group_spec.rb +2 -7
- data/spec/rspec/rails/example/view_example_group_spec.rb +2 -7
- data/spec/rspec/rails/matchers/route_to_spec.rb +2 -2
- data/spec/rspec/rails/mocks/mock_model_spec.rb +31 -0
- data/spec/spec_helper.rb +18 -0
- data/templates/generate_stuff.rb +1 -1
- metadata +28 -14
@@ -2,12 +2,14 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module RSpec::Rails
|
4
4
|
describe ControllerExampleGroup do
|
5
|
-
it
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
group = RSpec::Core::ExampleGroup.describe
|
10
|
-
|
5
|
+
it { should be_included_in_files_in('./spec/controllers/') }
|
6
|
+
it { should be_included_in_files_in('.\\spec\\controllers\\') }
|
7
|
+
|
8
|
+
it "includes routing matchers" do
|
9
|
+
group = RSpec::Core::ExampleGroup.describe do
|
10
|
+
include ControllerExampleGroup
|
11
|
+
end
|
12
|
+
group.included_modules.should include(RSpec::Rails::Matchers::RoutingMatchers)
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
@@ -3,14 +3,10 @@ require "spec_helper"
|
|
3
3
|
module RSpec::Rails
|
4
4
|
describe HelperExampleGroup::InstanceMethods do
|
5
5
|
module ::FoosHelper; end
|
6
|
+
subject { HelperExampleGroup }
|
6
7
|
|
7
|
-
it
|
8
|
-
|
9
|
-
:example_group => {:file_path => "./spec/helpers/whatever_spec.rb:15"}
|
10
|
-
)
|
11
|
-
group = RSpec::Core::ExampleGroup.describe
|
12
|
-
group.included_modules.should include(HelperExampleGroup)
|
13
|
-
end
|
8
|
+
it { should be_included_in_files_in('./spec/helpers/') }
|
9
|
+
it { should be_included_in_files_in('.\\spec\\helpers\\') }
|
14
10
|
|
15
11
|
it "provides a controller_path based on the helper module's name" do
|
16
12
|
helper_spec = Object.new.extend HelperExampleGroup::InstanceMethods
|
@@ -2,12 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module RSpec::Rails
|
4
4
|
describe MailerExampleGroup do
|
5
|
-
it
|
6
|
-
|
7
|
-
:example_group => {:file_path => "./spec/mailers/whatever_spec.rb:15"}
|
8
|
-
)
|
9
|
-
group = RSpec::Core::ExampleGroup.describe
|
10
|
-
group.included_modules.should include(MailerExampleGroup)
|
11
|
-
end
|
5
|
+
it { should be_included_in_files_in('./spec/mailers/') }
|
6
|
+
it { should be_included_in_files_in('.\\spec\\mailers\\') }
|
12
7
|
end
|
13
8
|
end
|
@@ -2,12 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module RSpec::Rails
|
4
4
|
describe RequestExampleGroup do
|
5
|
-
it
|
6
|
-
|
7
|
-
:example_group => {:file_path => "./spec/requests/whatever_spec.rb:15"}
|
8
|
-
)
|
9
|
-
group = RSpec::Core::ExampleGroup.describe
|
10
|
-
group.included_modules.should include(RequestExampleGroup)
|
11
|
-
end
|
5
|
+
it { should be_included_in_files_in('./spec/requests/') }
|
6
|
+
it { should be_included_in_files_in('.\\spec\\requests\\') }
|
12
7
|
end
|
13
8
|
end
|
@@ -2,12 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module RSpec::Rails
|
4
4
|
describe RoutingExampleGroup do
|
5
|
-
it
|
6
|
-
|
7
|
-
:example_group => {:file_path => "./spec/routing/whatever_spec.rb:15"}
|
8
|
-
)
|
9
|
-
group = RSpec::Core::ExampleGroup.describe
|
10
|
-
group.included_modules.should include(RoutingExampleGroup)
|
11
|
-
end
|
5
|
+
it { should be_included_in_files_in('./spec/routing/') }
|
6
|
+
it { should be_included_in_files_in('.\\spec\\routing\\') }
|
12
7
|
end
|
13
8
|
end
|
@@ -2,13 +2,8 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module RSpec::Rails
|
4
4
|
describe ViewExampleGroup do
|
5
|
-
it
|
6
|
-
|
7
|
-
:example_group => {:file_path => "./spec/views/whatever_spec.rb:15"}
|
8
|
-
)
|
9
|
-
group = RSpec::Core::ExampleGroup.describe
|
10
|
-
group.included_modules.should include(ViewExampleGroup)
|
11
|
-
end
|
5
|
+
it { should be_included_in_files_in('./spec/views/') }
|
6
|
+
it { should be_included_in_files_in('.\\spec\\views\\') }
|
12
7
|
|
13
8
|
describe "#render" do
|
14
9
|
let(:view_spec) do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe "route_to" do
|
4
|
-
include RSpec::Rails::
|
4
|
+
include RSpec::Rails::Matchers::RoutingMatchers
|
5
5
|
|
6
6
|
it "uses failure message from assert_routing" do
|
7
7
|
self.stub!(:assert_routing).and_raise(
|
@@ -13,7 +13,7 @@ describe "route_to" do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe "be_routable" do
|
16
|
-
include RSpec::Rails::
|
16
|
+
include RSpec::Rails::Matchers::RoutingMatchers
|
17
17
|
attr_reader :routes
|
18
18
|
|
19
19
|
before { @routes = double("routes") }
|
@@ -14,6 +14,37 @@ describe "mock_model(RealModel)" do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
describe "destroy" do
|
18
|
+
it "sets id to nil" do
|
19
|
+
model = mock_model(MockableModel)
|
20
|
+
model.destroy
|
21
|
+
model.id.should be_nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "errors" do
|
26
|
+
context "default" do
|
27
|
+
it "is empty" do
|
28
|
+
model = mock_model(MockableModel)
|
29
|
+
model.errors.should be_empty
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context "with :save => false" do
|
34
|
+
it "is not empty" do
|
35
|
+
model = mock_model(MockableModel, :save => false)
|
36
|
+
model.errors.should_not be_empty
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "with :update_attributes => false" do
|
41
|
+
it "is not empty" do
|
42
|
+
model = mock_model(MockableModel, :save => false)
|
43
|
+
model.errors.should_not be_empty
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
17
48
|
describe "with params" do
|
18
49
|
it "does not mutate its parameters" do
|
19
50
|
params = {:a => 'b'}
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler.setup
|
3
3
|
|
4
|
+
require 'active_record'
|
5
|
+
require 'action_controller'
|
6
|
+
require 'action_mailer'
|
4
7
|
require 'rspec/rails'
|
5
8
|
|
6
9
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
@@ -17,7 +20,22 @@ class RSpec::Core::ExampleGroup
|
|
17
20
|
end
|
18
21
|
end
|
19
22
|
|
23
|
+
module MatchesForRSpecRailsSpecs
|
24
|
+
extend RSpec::Matchers::DSL
|
25
|
+
|
26
|
+
matcher :be_included_in_files_in do |path|
|
27
|
+
match do |mod|
|
28
|
+
stub_metadata(
|
29
|
+
:example_group => {:file_path => "#{path}whatever_spec.rb:15"}
|
30
|
+
)
|
31
|
+
group = RSpec::Core::ExampleGroup.describe
|
32
|
+
group.included_modules.include?(mod)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
20
37
|
RSpec.configure do |c|
|
38
|
+
c.include MatchesForRSpecRailsSpecs
|
21
39
|
c.color_enabled = !in_editor?
|
22
40
|
c.before(:each) do
|
23
41
|
@real_world = RSpec.world
|
data/templates/generate_stuff.rb
CHANGED
@@ -4,7 +4,7 @@ generate('integration_test widgets')
|
|
4
4
|
generate('mailer Notifications signup')
|
5
5
|
generate('model thing name:string')
|
6
6
|
generate('helper things')
|
7
|
-
generate('scaffold widget name:string')
|
7
|
+
generate('scaffold widget name:string category:string instock:boolean')
|
8
8
|
generate('observer widget')
|
9
9
|
generate('scaffold gadget ') # scaffold with no attributes
|
10
10
|
|
metadata
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 124392765
|
4
5
|
prerelease: true
|
5
6
|
segments:
|
6
7
|
- 2
|
7
8
|
- 0
|
8
9
|
- 0
|
9
10
|
- beta
|
10
|
-
-
|
11
|
-
|
11
|
+
- 14
|
12
|
+
- 1
|
13
|
+
version: 2.0.0.beta.14.1
|
12
14
|
platform: ruby
|
13
15
|
authors:
|
14
16
|
- David Chelimsky
|
@@ -17,39 +19,43 @@ autorequire:
|
|
17
19
|
bindir: bin
|
18
20
|
cert_chain: []
|
19
21
|
|
20
|
-
date: 2010-06-
|
22
|
+
date: 2010-06-27 00:00:00 -05:00
|
21
23
|
default_executable:
|
22
24
|
dependencies:
|
23
25
|
- !ruby/object:Gem::Dependency
|
24
26
|
type: :runtime
|
27
|
+
prerelease: false
|
25
28
|
name: rspec
|
26
29
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
27
31
|
requirements:
|
28
|
-
- - "
|
32
|
+
- - ">="
|
29
33
|
- !ruby/object:Gem::Version
|
34
|
+
hash: 62196479
|
30
35
|
segments:
|
31
36
|
- 2
|
32
37
|
- 0
|
33
38
|
- 0
|
34
39
|
- beta
|
35
|
-
-
|
36
|
-
version: 2.0.0.beta.
|
40
|
+
- 14
|
41
|
+
version: 2.0.0.beta.14
|
37
42
|
requirement: *id001
|
38
|
-
prerelease: false
|
39
43
|
- !ruby/object:Gem::Dependency
|
40
44
|
type: :runtime
|
45
|
+
prerelease: false
|
41
46
|
name: webrat
|
42
47
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
43
49
|
requirements:
|
44
50
|
- - ">="
|
45
51
|
- !ruby/object:Gem::Version
|
52
|
+
hash: 3
|
46
53
|
segments:
|
47
54
|
- 0
|
48
55
|
- 7
|
49
56
|
- 0
|
50
57
|
version: 0.7.0
|
51
58
|
requirement: *id002
|
52
|
-
prerelease: false
|
53
59
|
description: RSpec-2 for Rails-3
|
54
60
|
email: dchelimsky@gmail.com;chad.humphries@gmail.com
|
55
61
|
executables: []
|
@@ -68,13 +74,13 @@ files:
|
|
68
74
|
- VERSION
|
69
75
|
- autotest/discover.rb
|
70
76
|
- cucumber.yml
|
71
|
-
- features/controller_specs/
|
77
|
+
- features/controller_specs/isolation_from_views.feature
|
72
78
|
- features/controller_specs/readers.feature
|
73
79
|
- features/controller_specs/render_views.feature
|
80
|
+
- features/matchers/be_routable_matcher.feature
|
74
81
|
- features/matchers/new_record_matcher.feature
|
75
82
|
- features/model_specs/errors_on.feature
|
76
83
|
- features/model_specs/transactional_examples.feature
|
77
|
-
- features/routing_specs/be_routable_matcher.feature
|
78
84
|
- features/step_definitions/model_steps.rb
|
79
85
|
- features/support/env.rb
|
80
86
|
- features/view_specs/view_spec.feature
|
@@ -128,8 +134,9 @@ files:
|
|
128
134
|
- lib/rspec/rails/matchers/have_extension.rb
|
129
135
|
- lib/rspec/rails/matchers/redirect_to.rb
|
130
136
|
- lib/rspec/rails/matchers/render_template.rb
|
131
|
-
- lib/rspec/rails/matchers/
|
137
|
+
- lib/rspec/rails/matchers/routing_matchers.rb
|
132
138
|
- lib/rspec/rails/mocks.rb
|
139
|
+
- lib/rspec/rails/module_inclusion.rb
|
133
140
|
- lib/rspec/rails/monkey.rb
|
134
141
|
- lib/rspec/rails/monkey/action_mailer/test_case.rb
|
135
142
|
- lib/rspec/rails/version.rb
|
@@ -164,7 +171,7 @@ licenses: []
|
|
164
171
|
post_install_message: |
|
165
172
|
**************************************************
|
166
173
|
|
167
|
-
Thank you for installing rspec-rails-2.0.0.beta.
|
174
|
+
Thank you for installing rspec-rails-2.0.0.beta.14.1!
|
168
175
|
|
169
176
|
This version of rspec-rails only works with
|
170
177
|
versions of rails >= 3.0.0.pre.
|
@@ -174,6 +181,9 @@ post_install_message: |
|
|
174
181
|
|
175
182
|
script/rails generate rspec:install
|
176
183
|
|
184
|
+
Also, be sure to look at Upgrade.markdown to see
|
185
|
+
what might have changed since the last release.
|
186
|
+
|
177
187
|
**************************************************
|
178
188
|
|
179
189
|
rdoc_options:
|
@@ -181,16 +191,20 @@ rdoc_options:
|
|
181
191
|
require_paths:
|
182
192
|
- lib
|
183
193
|
required_ruby_version: !ruby/object:Gem::Requirement
|
194
|
+
none: false
|
184
195
|
requirements:
|
185
196
|
- - ">="
|
186
197
|
- !ruby/object:Gem::Version
|
198
|
+
hash: 3
|
187
199
|
segments:
|
188
200
|
- 0
|
189
201
|
version: "0"
|
190
202
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
|
+
none: false
|
191
204
|
requirements:
|
192
205
|
- - ">"
|
193
206
|
- !ruby/object:Gem::Version
|
207
|
+
hash: 25
|
194
208
|
segments:
|
195
209
|
- 1
|
196
210
|
- 3
|
@@ -199,10 +213,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
213
|
requirements: []
|
200
214
|
|
201
215
|
rubyforge_project: rspec
|
202
|
-
rubygems_version: 1.3.
|
216
|
+
rubygems_version: 1.3.7
|
203
217
|
signing_key:
|
204
218
|
specification_version: 3
|
205
|
-
summary: rspec-rails-2.0.0.beta.
|
219
|
+
summary: rspec-rails-2.0.0.beta.14.1
|
206
220
|
test_files:
|
207
221
|
- spec/rspec/rails/example/controller_example_group_spec.rb
|
208
222
|
- spec/rspec/rails/example/helper_example_group_spec.rb
|