rspec-mocks 3.3.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Changelog.md +18 -1
- data/lib/rspec/mocks/proxy.rb +1 -1
- data/lib/rspec/mocks/space.rb +30 -5
- data/lib/rspec/mocks/verifying_proxy.rb +20 -4
- data/lib/rspec/mocks/version.rb +1 -1
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4da929a8edc5f89c1d58114f477ae88164702b0c
|
4
|
+
data.tar.gz: 227ea37af2920626b3b234ccbc2296c675727908
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6300103d6164dcccd0f20a1840bf3d1e36c757be831e3490af21315c9b528d23f6b268f9db75025a3fd51d06fd41b4dfbbe1767cde1adfa180f952ee1467d65
|
7
|
+
data.tar.gz: 6d36f14ed060d44da89f6b589df55b341a0ff42c706670e5548d6c3991753baf2f334802879fdc90978359820a72ed6e7301d3ee555aab828187b0c8576265eb
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
### 3.3.1 / 2015-06-19
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.3.0...v3.3.1)
|
3
|
+
|
4
|
+
Bug Fixes:
|
5
|
+
|
6
|
+
* Fix bug in `before_verifying_double` callback logic that caused it to be called
|
7
|
+
once for each class in the ancestor list when mocking or stubbing a class. Now
|
8
|
+
it is only called for the mocked or stubbed class, as you would expect. (Sam
|
9
|
+
Phippen, #974)
|
10
|
+
|
1
11
|
### 3.3.0 / 2015-06-12
|
2
12
|
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.2.1...v3.3.0)
|
3
13
|
|
@@ -356,7 +366,7 @@ Bug Fixes:
|
|
356
366
|
behavior. (Maurício Linhares)
|
357
367
|
|
358
368
|
### 3.0.0.beta1 / 2013-11-07
|
359
|
-
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.
|
369
|
+
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.4...v3.0.0.beta1)
|
360
370
|
|
361
371
|
Breaking Changes for 3.0.0:
|
362
372
|
|
@@ -419,6 +429,13 @@ Bug Fixes:
|
|
419
429
|
returns `nil` or `''` so that you still get a useful message.
|
420
430
|
(Nick DeLuca)
|
421
431
|
|
432
|
+
### 2.99.4 / 2015-06-19
|
433
|
+
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.3...v2.99.4)
|
434
|
+
|
435
|
+
Bug Fixes:
|
436
|
+
|
437
|
+
* Add missing deprecation for using `with` with no arguments e.g. `with()`. (Yousuke, #970)
|
438
|
+
|
422
439
|
### 2.99.3 / 2015-01-09
|
423
440
|
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.2...v2.99.3)
|
424
441
|
|
data/lib/rspec/mocks/proxy.rb
CHANGED
@@ -391,7 +391,7 @@ module RSpec
|
|
391
391
|
return @superclass_proxy if defined?(@superclass_proxy)
|
392
392
|
|
393
393
|
if (superclass = object.superclass)
|
394
|
-
@superclass_proxy = @source_space.
|
394
|
+
@superclass_proxy = @source_space.superclass_proxy_for(superclass)
|
395
395
|
else
|
396
396
|
@superclass_proxy = nil
|
397
397
|
end
|
data/lib/rspec/mocks/space.rb
CHANGED
@@ -35,6 +35,10 @@ module RSpec
|
|
35
35
|
false
|
36
36
|
end
|
37
37
|
|
38
|
+
def superclass_proxy_for(*_args)
|
39
|
+
raise_lifecycle_message
|
40
|
+
end
|
41
|
+
|
38
42
|
def new_scope
|
39
43
|
Space.new
|
40
44
|
end
|
@@ -109,6 +113,13 @@ module RSpec
|
|
109
113
|
end
|
110
114
|
end
|
111
115
|
|
116
|
+
def superclass_proxy_for(klass)
|
117
|
+
proxy_mutex.synchronize do
|
118
|
+
id = id_for(klass)
|
119
|
+
proxies.fetch(id) { superclass_proxy_not_found_for(id, klass) }
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
112
123
|
alias ensure_registered proxy_for
|
113
124
|
|
114
125
|
def registered?(object)
|
@@ -150,11 +161,7 @@ module RSpec
|
|
150
161
|
when NilClass then ProxyForNil.new(@expectation_ordering)
|
151
162
|
when TestDouble then object.__build_mock_proxy_unless_expired(@expectation_ordering)
|
152
163
|
when Class
|
153
|
-
|
154
|
-
VerifyingPartialClassDoubleProxy.new(self, object, @expectation_ordering)
|
155
|
-
else
|
156
|
-
PartialClassDoubleProxy.new(self, object, @expectation_ordering)
|
157
|
-
end
|
164
|
+
class_proxy_with_callback_verification_strategy(object, CallbackInvocationStrategy.new)
|
158
165
|
else
|
159
166
|
if RSpec::Mocks.configuration.verify_partial_doubles?
|
160
167
|
VerifyingPartialDoubleProxy.new(object, @expectation_ordering)
|
@@ -164,6 +171,24 @@ module RSpec
|
|
164
171
|
end
|
165
172
|
end
|
166
173
|
|
174
|
+
def superclass_proxy_not_found_for(id, object)
|
175
|
+
raise "superclass_proxy_not_found_for called with something that is not a class" unless Class === object
|
176
|
+
proxies[id] = class_proxy_with_callback_verification_strategy(object, NoCallbackInvocationStrategy.new)
|
177
|
+
end
|
178
|
+
|
179
|
+
def class_proxy_with_callback_verification_strategy(object, strategy)
|
180
|
+
if RSpec::Mocks.configuration.verify_partial_doubles?
|
181
|
+
VerifyingPartialClassDoubleProxy.new(
|
182
|
+
self,
|
183
|
+
object,
|
184
|
+
@expectation_ordering,
|
185
|
+
strategy
|
186
|
+
)
|
187
|
+
else
|
188
|
+
PartialClassDoubleProxy.new(self, object, @expectation_ordering)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
167
192
|
def any_instance_recorder_not_found_for(id, klass)
|
168
193
|
any_instance_recorders[id] = AnyInstance::Recorder.new(klass)
|
169
194
|
end
|
@@ -3,6 +3,21 @@ RSpec::Support.require_rspec_mocks 'method_reference'
|
|
3
3
|
|
4
4
|
module RSpec
|
5
5
|
module Mocks
|
6
|
+
# @private
|
7
|
+
class CallbackInvocationStrategy
|
8
|
+
def call(doubled_module)
|
9
|
+
RSpec::Mocks.configuration.verifying_double_callbacks.each do |block|
|
10
|
+
block.call doubled_module
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# @private
|
16
|
+
class NoCallbackInvocationStrategy
|
17
|
+
def call(_doubled_module)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
6
21
|
# @private
|
7
22
|
module VerifyingProxyMethods
|
8
23
|
def add_stub(method_name, opts={}, &implementation)
|
@@ -85,11 +100,14 @@ module RSpec
|
|
85
100
|
end
|
86
101
|
end
|
87
102
|
|
103
|
+
# @private
|
104
|
+
DEFAULT_CALLBACK_INVOCATION_STRATEGY = CallbackInvocationStrategy.new
|
105
|
+
|
88
106
|
# @private
|
89
107
|
class VerifyingPartialDoubleProxy < PartialDoubleProxy
|
90
108
|
include VerifyingProxyMethods
|
91
109
|
|
92
|
-
def initialize(object, expectation_ordering)
|
110
|
+
def initialize(object, expectation_ordering, optional_callback_invocation_strategy=DEFAULT_CALLBACK_INVOCATION_STRATEGY)
|
93
111
|
super(object, expectation_ordering)
|
94
112
|
@doubled_module = DirectObjectReference.new(object)
|
95
113
|
|
@@ -99,9 +117,7 @@ module RSpec
|
|
99
117
|
h[k] = VerifyingExistingMethodDouble.for(object, k, self)
|
100
118
|
end
|
101
119
|
|
102
|
-
|
103
|
-
block.call @doubled_module
|
104
|
-
end
|
120
|
+
optional_callback_invocation_strategy.call(@doubled_module)
|
105
121
|
end
|
106
122
|
|
107
123
|
def method_reference
|
data/lib/rspec/mocks/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-mocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Baker
|
@@ -45,7 +45,7 @@ cert_chain:
|
|
45
45
|
ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
|
46
46
|
F3MdtaDehhjC
|
47
47
|
-----END CERTIFICATE-----
|
48
|
-
date: 2015-06-
|
48
|
+
date: 2015-06-20 00:00:00.000000000 Z
|
49
49
|
dependencies:
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
name: rspec-support
|
@@ -212,6 +212,6 @@ rubyforge_project:
|
|
212
212
|
rubygems_version: 2.2.2
|
213
213
|
signing_key:
|
214
214
|
specification_version: 4
|
215
|
-
summary: rspec-mocks-3.3.
|
215
|
+
summary: rspec-mocks-3.3.1
|
216
216
|
test_files: []
|
217
217
|
has_rdoc:
|
metadata.gz.sig
CHANGED
Binary file
|