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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0bb4586d03e4b2bf84d904af032165dfae270599
4
- data.tar.gz: 6889f7727cf4545a05618a19c0f7ff35174718ff
3
+ metadata.gz: 4da929a8edc5f89c1d58114f477ae88164702b0c
4
+ data.tar.gz: 227ea37af2920626b3b234ccbc2296c675727908
5
5
  SHA512:
6
- metadata.gz: 5bb9e03448dfde3e78aec7388dd7b49bccb8005ec49a7ab525b41818a6678e41568fa7946a4d443a8103058d77c4ae2760ac07eb69b0ef37dd39f197e580aa48
7
- data.tar.gz: 00a6e20fb91ccb3dd7212ac5877e9b348609aede07ed8158aee6032f1e30d7d89a833a7d1107343e780da15daa0800d94985cdd151796434f5413c8663935fa0
6
+ metadata.gz: a6300103d6164dcccd0f20a1840bf3d1e36c757be831e3490af21315c9b528d23f6b268f9db75025a3fd51d06fd41b4dfbbe1767cde1adfa180f952ee1467d65
7
+ data.tar.gz: 6d36f14ed060d44da89f6b589df55b341a0ff42c706670e5548d6c3991753baf2f334802879fdc90978359820a72ed6e7301d3ee555aab828187b0c8576265eb
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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.3...v3.0.0.beta1)
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
 
@@ -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.proxy_for(superclass)
394
+ @superclass_proxy = @source_space.superclass_proxy_for(superclass)
395
395
  else
396
396
  @superclass_proxy = nil
397
397
  end
@@ -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
- if RSpec::Mocks.configuration.verify_partial_doubles?
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
- RSpec::Mocks.configuration.verifying_double_callbacks.each do |block|
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
@@ -3,7 +3,7 @@ module RSpec
3
3
  # Version information for RSpec mocks.
4
4
  module Version
5
5
  # Version of RSpec mocks currently in use in SemVer format.
6
- STRING = '3.3.0'
6
+ STRING = '3.3.1'
7
7
  end
8
8
  end
9
9
  end
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.0
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-12 00:00:00.000000000 Z
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.0
215
+ summary: rspec-mocks-3.3.1
216
216
  test_files: []
217
217
  has_rdoc:
metadata.gz.sig CHANGED
Binary file