rspec-mocks 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c8e75bed0a7161714dd94c0b57f20dc5ba9a66e
4
- data.tar.gz: 81b87208da7820952c059230b059f95607755fcc
3
+ metadata.gz: b1bc4975e669df2055273dea6d7d5408f8fdb7c8
4
+ data.tar.gz: 1c8ed12a97b2da9679629fd7e5d13cf9653fae8f
5
5
  SHA512:
6
- metadata.gz: 8092e85f567a248612be5fab6b6c37ecaed74f152ac43f90e0b8ee35fb417a559da2c31de5fe0b7e0679ff6879531ba8298fab92e07eacf57fa16e0d2de71483
7
- data.tar.gz: 211a7d27ea79fe0e443f18c99bf9574ad1549e721a12091e93e76711a7333d43891e0a882e4750414e1d04a10c082776e21902089e6929c060833583be8489a5
6
+ metadata.gz: e50b72cd647cca2f11399a0449a552bcfba4573239a61182a5820443695f29bcba5a332083ffbcb42e56b0a45dcb103c26a85aff9acfe81f2f49710c8b8486b1
7
+ data.tar.gz: 229af01a4b572a4eded313234f40d650f674f7ceb0b162210d7187a58861fd3c971d1bca5423185733f188ae8454c7053dde5009dc899010a84a00a6f3b43807
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,4 +1,16 @@
1
- ### 3.0.1 /2014-06-07
1
+ ### 3.0.2 / 2014-06-19
2
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.0.1...v3.0.2)
3
+
4
+ Bug Fixes:
5
+
6
+ * Fix edge case that triggered "can't add a new key into hash during
7
+ iteration" during mock verification. (Sam Phippen, Myron Marston, #711)
8
+ * Fix verifying doubles so that when they accidentally leak into another
9
+ example, they provide the same clear error message that normal doubles
10
+ do. (Myron Marston, #718)
11
+ * Make `ordered` work with exact receive counts. (Sam Phippen, #713)
12
+
13
+ ### 3.0.1 / 2014-06-07
2
14
  [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.0.0...v3.0.1)
3
15
 
4
16
  Bug Fixes:
@@ -215,6 +227,18 @@ Bug Fixes:
215
227
  returns `nil` or `''` so that you still get a useful message.
216
228
  (Nick DeLuca)
217
229
 
230
+ ### 2.99.1 / 2014-06-12
231
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.0...v2.99.1)
232
+
233
+ Bug Fixes:
234
+
235
+ * Fix bug that caused errors at the end of each example
236
+ when a `double.as_null_object` had been frozen. (Yuji Nakayama, #698)
237
+
238
+ Deprecations:
239
+
240
+ * Deprecate freezing a test double. (Yuji Nakayama, #698)
241
+
218
242
  ### 2.99.0 / 2014-06-01
219
243
  [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.0.rc1...v2.99.0)
220
244
 
@@ -22,7 +22,7 @@ module RSpec
22
22
  # @example
23
23
  #
24
24
  # RSpec.configure do |rspec|
25
- # rspec.mock_with :rspc do |mocks|
25
+ # rspec.mock_with :rspec do |mocks|
26
26
  # mocks.yield_receiver_to_any_instance_implementation_blocks = false
27
27
  # end
28
28
  # end
@@ -59,6 +59,7 @@ module RSpec
59
59
  @argument_list_matcher = ArgumentListMatcher::MATCH_ALL
60
60
  @order_group = expectation_ordering
61
61
  @order_group.register(self) unless type == :stub
62
+ @expectation_type = type
62
63
  @ordered = false
63
64
  @at_least = @at_most = @exactly = nil
64
65
  @args_to_yield = []
@@ -438,10 +439,20 @@ module RSpec
438
439
  # expect(api).to receive(:finish).ordered
439
440
  def ordered(&block)
440
441
  self.inner_implementation_action = block
442
+ additional_expected_calls.times do
443
+ @order_group.register(self)
444
+ end
441
445
  @ordered = true
442
446
  self
443
447
  end
444
448
 
449
+ # @private
450
+ def additional_expected_calls
451
+ return 0 if @expectation_type == :stub || !@exactly
452
+ @expected_received_count - 1
453
+ end
454
+
455
+
445
456
  # @private
446
457
  def ordered?
447
458
  @ordered
@@ -65,7 +65,7 @@ module RSpec
65
65
  end
66
66
 
67
67
  def verify_all
68
- proxies.each_value { |proxy| proxy.verify }
68
+ proxies.values.each { |proxy| proxy.verify }
69
69
  any_instance_recorders.each_value { |recorder| recorder.verify }
70
70
  end
71
71
 
@@ -148,7 +148,7 @@ module RSpec
148
148
  def proxy_not_found_for(id, object)
149
149
  proxies[id] = case object
150
150
  when NilClass then ProxyForNil.new(@expectation_ordering)
151
- when TestDouble then object.__build_mock_proxy(@expectation_ordering)
151
+ when TestDouble then object.__build_mock_proxy_unless_expired(@expectation_ordering)
152
152
  when Class
153
153
  if RSpec::Mocks.configuration.verify_partial_doubles?
154
154
  VerifyingPartialClassDoubleProxy.new(self, object, @expectation_ordering)
@@ -53,8 +53,8 @@ module RSpec
53
53
  end
54
54
 
55
55
  # @private
56
- def __build_mock_proxy(order_group)
57
- __raise_expired_error or TestDoubleProxy.new(self, order_group, @name)
56
+ def __build_mock_proxy_unless_expired(order_group)
57
+ __raise_expired_error or __build_mock_proxy(order_group)
58
58
  end
59
59
 
60
60
  # @private
@@ -111,6 +111,10 @@ module RSpec
111
111
  ::RSpec::Mocks.space.proxy_for(self)
112
112
  end
113
113
 
114
+ def __build_mock_proxy(order_group)
115
+ TestDoubleProxy.new(self, order_group, @name)
116
+ end
117
+
114
118
  def __raise_expired_error
115
119
  return false unless @__expired
116
120
  ErrorGenerator.new(self, @name).raise_expired_test_double_error
@@ -88,6 +88,13 @@ module RSpec
88
88
  include TestDouble
89
89
  include VerifyingDouble
90
90
 
91
+ def as_stubbed_const(options = {})
92
+ ConstantMutator.stub(@doubled_module.const_to_replace, self, options)
93
+ self
94
+ end
95
+
96
+ private
97
+
91
98
  def initialize(doubled_module, *args)
92
99
  @doubled_module = doubled_module
93
100
  super(doubled_module.description, *args)
@@ -99,11 +106,6 @@ module RSpec
99
106
  ObjectMethodReference
100
107
  )
101
108
  end
102
-
103
- def as_stubbed_const(options = {})
104
- ConstantMutator.stub(@doubled_module.const_to_replace, self, options)
105
- self
106
- end
107
109
  end
108
110
 
109
111
  # Similar to an InstanceVerifyingDouble, except that it verifies against
@@ -54,7 +54,7 @@ module RSpec
54
54
  # isolation.
55
55
  #
56
56
  # @private
57
- class VerifyingProxy < Proxy
57
+ class VerifyingProxy < TestDoubleProxy
58
58
  include VerifyingProxyMethods
59
59
 
60
60
  def initialize(object, order_group, name, doubled_module, method_reference_class)
@@ -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.0.1'
6
+ STRING = '3.0.2'
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.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Baker
@@ -33,7 +33,7 @@ cert_chain:
33
33
  1yHC1AcSYpvi2dAbOiHT5iQF+krm4wse8KctXgTNnjMsHEoGKulJS2/sZl90jcCz
34
34
  muA=
35
35
  -----END CERTIFICATE-----
36
- date: 2014-06-07 00:00:00.000000000 Z
36
+ date: 2014-06-20 00:00:00.000000000 Z
37
37
  dependencies:
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: rspec-support
@@ -179,6 +179,6 @@ rubyforge_project: rspec
179
179
  rubygems_version: 2.2.2
180
180
  signing_key:
181
181
  specification_version: 4
182
- summary: rspec-mocks-3.0.1
182
+ summary: rspec-mocks-3.0.2
183
183
  test_files: []
184
184
  has_rdoc:
metadata.gz.sig CHANGED
Binary file