rspec-mocks 2.11.0 → 2.11.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog.md +10 -0
- data/lib/rspec/mocks/method_double.rb +6 -0
- data/lib/rspec/mocks/proxy.rb +9 -2
- data/lib/rspec/mocks/version.rb +1 -1
- data/spec/rspec/mocks/null_object_mock_spec.rb +6 -0
- metadata +67 -57
data/Changelog.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
### 2.11.1 / 2012-07-09
|
2
|
+
[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.11.0...v2.11.1)
|
3
|
+
|
4
|
+
Bug fixes
|
5
|
+
|
6
|
+
* Fix `should_receive` so that when it is called on an `as_null_object`
|
7
|
+
double with no implementation, and there is a previous explicit stub
|
8
|
+
for the same method, the explicit stub remains (rather than being
|
9
|
+
overriden with the null object implementation--`return self`). (Myron Marston)
|
10
|
+
|
1
11
|
### 2.11.0 / 2012-07-07
|
2
12
|
[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.10.1...v2.11.0)
|
3
13
|
|
@@ -158,6 +158,12 @@ module RSpec
|
|
158
158
|
stub
|
159
159
|
end
|
160
160
|
|
161
|
+
# @private
|
162
|
+
def add_default_stub(*args, &implementation)
|
163
|
+
return if stubs.any?
|
164
|
+
add_stub(*args, &implementation)
|
165
|
+
end
|
166
|
+
|
161
167
|
# @private
|
162
168
|
def remove_stub
|
163
169
|
raise_method_not_stubbed_error if stubs.empty?
|
data/lib/rspec/mocks/proxy.rb
CHANGED
@@ -65,8 +65,15 @@ module RSpec
|
|
65
65
|
|
66
66
|
# @private
|
67
67
|
def add_message_expectation(location, method_name, opts={}, &block)
|
68
|
-
|
69
|
-
|
68
|
+
meth_double = method_double[method_name]
|
69
|
+
|
70
|
+
if null_object? && !block
|
71
|
+
meth_double.add_default_stub(@error_generator, @expectation_ordering, location, opts) do
|
72
|
+
@object
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
meth_double.add_expectation @error_generator, @expectation_ordering, location, opts, &block
|
70
77
|
end
|
71
78
|
|
72
79
|
# @private
|
data/lib/rspec/mocks/version.rb
CHANGED
@@ -50,6 +50,12 @@ module RSpec
|
|
50
50
|
@double.foo.bar.should be(@double)
|
51
51
|
end
|
52
52
|
|
53
|
+
it 'returns an explicitly stubbed value from an expectation with no implementation' do
|
54
|
+
@double.stub(:foo => "bar")
|
55
|
+
@double.should_receive(:foo)
|
56
|
+
@double.foo.should eq("bar")
|
57
|
+
end
|
58
|
+
|
53
59
|
it "fails verification when explicit exception not met" do
|
54
60
|
lambda do
|
55
61
|
@double.should_receive(:something)
|
metadata
CHANGED
@@ -1,71 +1,80 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-mocks
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 33
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 2
|
8
|
+
- 11
|
9
|
+
- 1
|
10
|
+
version: 2.11.1
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Steven Baker
|
9
14
|
- David Chelimsky
|
10
15
|
autorequire:
|
11
16
|
bindir: bin
|
12
17
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
18
|
+
|
19
|
+
date: 2012-07-10 00:00:00 Z
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
16
22
|
name: rake
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
|
-
requirements:
|
20
|
-
- - ~>
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 0.9.2
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
26
26
|
none: false
|
27
|
-
requirements:
|
27
|
+
requirements:
|
28
28
|
- - ~>
|
29
|
-
- !ruby/object:Gem::Version
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 63
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
- 9
|
34
|
+
- 2
|
30
35
|
version: 0.9.2
|
31
|
-
|
36
|
+
requirement: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
32
38
|
name: cucumber
|
33
|
-
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
|
-
requirements:
|
36
|
-
- - ~>
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
version: 1.1.9
|
39
39
|
type: :development
|
40
40
|
prerelease: false
|
41
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
|
-
requirements:
|
43
|
+
requirements:
|
44
44
|
- - ~>
|
45
|
-
- !ruby/object:Gem::Version
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 1
|
47
|
+
segments:
|
48
|
+
- 1
|
49
|
+
- 1
|
50
|
+
- 9
|
46
51
|
version: 1.1.9
|
47
|
-
|
52
|
+
requirement: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
48
54
|
name: aruba
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 0.4.11
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
58
58
|
none: false
|
59
|
-
requirements:
|
59
|
+
requirements:
|
60
60
|
- - ~>
|
61
|
-
- !ruby/object:Gem::Version
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
hash: 25
|
63
|
+
segments:
|
64
|
+
- 0
|
65
|
+
- 4
|
66
|
+
- 11
|
62
67
|
version: 0.4.11
|
68
|
+
requirement: *id003
|
63
69
|
description: RSpec's 'test double' framework, with support for stubbing and mocking
|
64
70
|
email: rspec-users@rubyforge.org
|
65
71
|
executables: []
|
72
|
+
|
66
73
|
extensions: []
|
74
|
+
|
67
75
|
extra_rdoc_files: []
|
68
|
-
|
76
|
+
|
77
|
+
files:
|
69
78
|
- lib/rspec/mocks.rb
|
70
79
|
- lib/rspec/mocks/any_instance.rb
|
71
80
|
- lib/rspec/mocks/any_instance/chain.rb
|
@@ -175,38 +184,39 @@ files:
|
|
175
184
|
- spec/rspec/mocks_spec.rb
|
176
185
|
- spec/spec_helper.rb
|
177
186
|
homepage: http://github.com/rspec/rspec-mocks
|
178
|
-
licenses:
|
187
|
+
licenses:
|
179
188
|
- MIT
|
180
189
|
post_install_message:
|
181
|
-
rdoc_options:
|
190
|
+
rdoc_options:
|
182
191
|
- --charset=UTF-8
|
183
|
-
require_paths:
|
192
|
+
require_paths:
|
184
193
|
- lib
|
185
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
194
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
186
195
|
none: false
|
187
|
-
requirements:
|
188
|
-
- -
|
189
|
-
- !ruby/object:Gem::Version
|
190
|
-
|
191
|
-
segments:
|
196
|
+
requirements:
|
197
|
+
- - ">="
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
hash: 3
|
200
|
+
segments:
|
192
201
|
- 0
|
193
|
-
|
194
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
|
+
version: "0"
|
203
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
204
|
none: false
|
196
|
-
requirements:
|
197
|
-
- -
|
198
|
-
- !ruby/object:Gem::Version
|
199
|
-
|
200
|
-
segments:
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
hash: 3
|
209
|
+
segments:
|
201
210
|
- 0
|
202
|
-
|
211
|
+
version: "0"
|
203
212
|
requirements: []
|
213
|
+
|
204
214
|
rubyforge_project: rspec
|
205
|
-
rubygems_version: 1.8.
|
215
|
+
rubygems_version: 1.8.6
|
206
216
|
signing_key:
|
207
217
|
specification_version: 3
|
208
|
-
summary: rspec-mocks-2.11.
|
209
|
-
test_files:
|
218
|
+
summary: rspec-mocks-2.11.1
|
219
|
+
test_files:
|
210
220
|
- features/README.md
|
211
221
|
- features/Scope.md
|
212
222
|
- features/Upgrade.md
|