rspec-mocks-diag 3.8.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/.yardopts +6 -0
  4. data/Changelog.md +1108 -0
  5. data/LICENSE.md +25 -0
  6. data/README.md +460 -0
  7. data/lib/rspec/mocks.rb +130 -0
  8. data/lib/rspec/mocks/any_instance.rb +11 -0
  9. data/lib/rspec/mocks/any_instance/chain.rb +110 -0
  10. data/lib/rspec/mocks/any_instance/error_generator.rb +31 -0
  11. data/lib/rspec/mocks/any_instance/expect_chain_chain.rb +31 -0
  12. data/lib/rspec/mocks/any_instance/expectation_chain.rb +50 -0
  13. data/lib/rspec/mocks/any_instance/message_chains.rb +83 -0
  14. data/lib/rspec/mocks/any_instance/proxy.rb +116 -0
  15. data/lib/rspec/mocks/any_instance/recorder.rb +289 -0
  16. data/lib/rspec/mocks/any_instance/stub_chain.rb +51 -0
  17. data/lib/rspec/mocks/any_instance/stub_chain_chain.rb +23 -0
  18. data/lib/rspec/mocks/argument_list_matcher.rb +100 -0
  19. data/lib/rspec/mocks/argument_matchers.rb +320 -0
  20. data/lib/rspec/mocks/configuration.rb +212 -0
  21. data/lib/rspec/mocks/error_generator.rb +378 -0
  22. data/lib/rspec/mocks/example_methods.rb +434 -0
  23. data/lib/rspec/mocks/instance_method_stasher.rb +146 -0
  24. data/lib/rspec/mocks/marshal_extension.rb +41 -0
  25. data/lib/rspec/mocks/matchers/expectation_customization.rb +20 -0
  26. data/lib/rspec/mocks/matchers/have_received.rb +134 -0
  27. data/lib/rspec/mocks/matchers/receive.rb +132 -0
  28. data/lib/rspec/mocks/matchers/receive_message_chain.rb +82 -0
  29. data/lib/rspec/mocks/matchers/receive_messages.rb +77 -0
  30. data/lib/rspec/mocks/message_chain.rb +87 -0
  31. data/lib/rspec/mocks/message_expectation.rb +748 -0
  32. data/lib/rspec/mocks/method_double.rb +287 -0
  33. data/lib/rspec/mocks/method_reference.rb +202 -0
  34. data/lib/rspec/mocks/minitest_integration.rb +68 -0
  35. data/lib/rspec/mocks/mutate_const.rb +339 -0
  36. data/lib/rspec/mocks/object_reference.rb +149 -0
  37. data/lib/rspec/mocks/order_group.rb +81 -0
  38. data/lib/rspec/mocks/proxy.rb +485 -0
  39. data/lib/rspec/mocks/space.rb +238 -0
  40. data/lib/rspec/mocks/standalone.rb +3 -0
  41. data/lib/rspec/mocks/syntax.rb +325 -0
  42. data/lib/rspec/mocks/targets.rb +124 -0
  43. data/lib/rspec/mocks/test_double.rb +171 -0
  44. data/lib/rspec/mocks/verifying_double.rb +129 -0
  45. data/lib/rspec/mocks/verifying_message_expectation.rb +54 -0
  46. data/lib/rspec/mocks/verifying_proxy.rb +220 -0
  47. data/lib/rspec/mocks/version.rb +9 -0
  48. metadata +186 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 77e3ee2ecfc877fba5c1c9032d0f07f108407f504e18afdb32a3b47da49d44af
4
+ data.tar.gz: fa4505b692822a38ecff0dab0e3906fae12ef68e1f8bcd4b5fc465935bdf37fc
5
+ SHA512:
6
+ metadata.gz: 1def73cb2de11472ad0a7b573fea7dc93a9f19afce654072331d3c9ec378ef28e3263e99cbc45a06fd2223bdc7fdcd3997f3eb710a0b3a34a35d7f468367aa70
7
+ data.tar.gz: d4f6f36a9c8e18b624c2b5300b7fb703fdf4291c9231f9067662abc1f1794b4ce1a89a238d50c5702aca46b37c408f64a78a11322db3ba42245d410a3a07757a
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ -
3
+ README.md
4
+ LICENSE.md
5
+ Changelog.md
@@ -0,0 +1,6 @@
1
+ --exclude features
2
+ --no-private
3
+ --markup markdown
4
+ -
5
+ Changelog.md
6
+ LICENSE.md
@@ -0,0 +1,1108 @@
1
+ ### 3.8.1 / 2019-06-13
2
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.8.0...v3.8.1)
3
+
4
+ Bug Fixes:
5
+
6
+ * Ensure stubbing methods does not change their visibility.
7
+ (Kevin Boschert, #1277)
8
+
9
+ ### 3.8.0 / 2018-08-04
10
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.7.0...v3.8.0)
11
+
12
+ Bug Fixes:
13
+
14
+ * Issue error when encountering invalid "counted" negative message expectations.
15
+ (Sergiy Yarinovskiy, #1212)
16
+ * Ensure `allow_any_instance_of` and `expect_any_instance_of` can be temporarily
17
+ supressed. (Jon Rowe, #1228)
18
+ * Ensure `expect_any_instance_of(double).to_not have_received(:some_method)`
19
+ fails gracefully (as its not supported) rather than issuing a `NoMethodError`.
20
+ (Maxim Krizhanovsky, #1231)
21
+
22
+ ### 3.7.0 / 2017-10-17
23
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.6.0...v3.7.0)
24
+
25
+ Enhancements:
26
+
27
+ * Improve compatibility with `--enable-frozen-string-literal` option
28
+ on Ruby 2.3+. (Pat Allan, #1165)
29
+
30
+ Bug Fixes:
31
+
32
+ * Fix `hash_including` and `hash_excluding` so that they work against
33
+ subclasses of `Hash`. (Aaron Rosenberg, #1167)
34
+
35
+ ### 3.6.0 / 2017-05-04
36
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.6.0.beta2...v3.6.0)
37
+
38
+ Bug Fixes:
39
+
40
+ * Fix "instance variable @color not initialized" warning when using
41
+ rspec-mocks without rspec-core. (Myron Marston, #1142)
42
+ * Restore aliased module methods properly when stubbing on 1.8.7.
43
+ (Samuel Giddins, #1144)
44
+ * Allow a message chain expectation to be constrained by argument(s).
45
+ (Jon Rowe, #1156)
46
+
47
+ ### 3.6.0.beta2 / 2016-12-12
48
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.6.0.beta1...v3.6.0.beta2)
49
+
50
+ Enhancements:
51
+
52
+ * Add new `without_partial_double_verification { }` API that lets you
53
+ temporarily turn off partial double verification for an example.
54
+ (Jon Rowe, #1104)
55
+
56
+ ### 3.6.0.beta1 / 2016-10-09
57
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.5.0...v3.6.0.beta1)
58
+
59
+ Bug Fixes:
60
+
61
+ * Return the test double instance form `#freeze` (Alessandro Berardi, #1109)
62
+ * Allow the special logic for stubbing `new` to work when `<Class>.method` has
63
+ been redefined. (Proby, #1119)
64
+
65
+ ### 3.5.0 / 2016-07-01
66
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.5.0.beta4...v3.5.0)
67
+
68
+ Enhancements:
69
+
70
+ * Provides a nice string representation of
71
+ `RSpec::Mocks::MessageExpectation` (Myron Marston, #1095)
72
+
73
+ ### 3.5.0.beta4 / 2016-06-05
74
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.5.0.beta3...v3.5.0.beta4)
75
+
76
+ Enhancements:
77
+
78
+ * Add `and_throw` to any instance handling. (Tobias Bühlmann, #1068)
79
+
80
+ ### 3.5.0.beta3 / 2016-04-02
81
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.5.0.beta2...v3.5.0.beta3)
82
+
83
+ Enhancements:
84
+
85
+ * Issue warning when attempting to use unsupported
86
+ `allow(...).to receive(...).ordered`. (Jon Rowe, #1000)
87
+ * Add `rspec/mocks/minitest_integration`, to properly integrate rspec-mocks
88
+ with minitest. (Myron Marston, #1065)
89
+
90
+ ### 3.5.0.beta2 / 2016-03-10
91
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.5.0.beta1...v3.5.0.beta2)
92
+
93
+ Enhancements:
94
+
95
+ * Improve error message displayed when using `and_wrap_original` on pure test
96
+ doubles. (betesh, #1063)
97
+
98
+ Bug Fixes:
99
+
100
+ * Fix issue that prevented `receive_message_chain(...).with(...)` working
101
+ correctly on "any instance" mocks. (Jon Rowe, #1061)
102
+
103
+ ### 3.5.0.beta1 / 2016-02-06
104
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.4.1...v3.5.0.beta1)
105
+
106
+ Bug Fixes:
107
+
108
+ * Allow `any_instance_of(...).to receive(...)` to use `and_yield` multiple
109
+ times. (Kilian Cirera Sant, #1054)
110
+ * Allow matchers which inherit from `rspec-mocks` matchers to be used for
111
+ `allow`. (Andrew Kozin, #1056)
112
+ * Prevent stubbing `respond_to?` on partial doubles from causing infinite
113
+ recursion. (Jon Rowe, #1013)
114
+ * Prevent aliased methods from disapearing after being mocked with
115
+ `any_instance` (regression from #1043). (Joe Rafaniello, #1060)
116
+
117
+ ### 3.4.1 / 2016-01-10
118
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.4.0...v3.4.1)
119
+
120
+ Bug Fixes:
121
+
122
+ * Fix `any_instance` to work properly on Ruby 2.3. (Joe Rafaniello, #1043)
123
+
124
+ ### 3.4.0 / 2015-11-11
125
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.3.2...v3.4.0)
126
+
127
+ Enhancements:
128
+
129
+ * Make `expect(...).to have_received` work without relying upon
130
+ rspec-expectations. (Myron Marston, #978)
131
+ * Add option for failing tests when expectations are set on `nil`.
132
+ (Liz Rush, #983)
133
+
134
+ Bug Fixes:
135
+
136
+ * Fix `have_received { ... }` so that any block passed when the message
137
+ was received is forwarded to the `have_received` block. (Myron Marston, #1006)
138
+ * Fix infinite loop in error generator when stubbing `respond_to?`.
139
+ (Alex Dowad, #1022)
140
+ * Fix issue with using `receive` on subclasses (at a class level) with 1.8.7.
141
+ (Alex Dowad, #1026)
142
+
143
+ ### 3.3.2 / 2015-07-15
144
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.3.1...v3.3.2)
145
+
146
+ Bug Fixes:
147
+
148
+ * Prevent thread deadlock errors during proxy creation (e.g. when using
149
+ `before_verifying_doubles` callbacks). (Jon Rowe, #980, #979)
150
+
151
+ ### 3.3.1 / 2015-06-19
152
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.3.0...v3.3.1)
153
+
154
+ Bug Fixes:
155
+
156
+ * Fix bug in `before_verifying_double` callback logic that caused it to be called
157
+ once for each class in the ancestor list when mocking or stubbing a class. Now
158
+ it is only called for the mocked or stubbed class, as you would expect. (Sam
159
+ Phippen, #974)
160
+
161
+ ### 3.3.0 / 2015-06-12
162
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.2.1...v3.3.0)
163
+
164
+ Enhancements:
165
+
166
+ * When stubbing `new` on `MyClass` or `class_double(MyClass)`, use the
167
+ method signature from `MyClass#initialize` to verify arguments.
168
+ (Myron Marston, #886)
169
+ * Use matcher descriptions when generating description of received arguments
170
+ for mock expectation failures. (Tim Wade, #891)
171
+ * Avoid loading `stringio` unnecessarily. (Myron Marston, #894)
172
+ * Verifying doubles failure messages now distinguish between class and instance
173
+ level methods. (Tim Wade, #896, #908)
174
+ * Improve mock expectation failure messages so that it combines both
175
+ number of times and the received arguments in the output. (John Ceh, #918)
176
+ * Improve how test doubles are represented in failure messages.
177
+ (Siva Gollapalli, Myron Marston, #932)
178
+ * Rename `RSpec::Mocks::Configuration#when_declaring_verifying_double` to
179
+ `RSpec::Mocks::Configuration#before_verifying_doubles` and utilise when
180
+ verifying partial doubles. (Jon Rowe, #940)
181
+ * Use rspec-support's `ObjectFormatter` for improved formatting of
182
+ arguments in failure messages so that, for example, full time
183
+ precisions is displayed for time objects. (Gavin Miller, Myron Marston, #955)
184
+
185
+ Bug Fixes:
186
+
187
+ * Ensure expectations that raise eagerly also raise during RSpec verification.
188
+ This means that if exceptions are caught inside test execution the test will
189
+ still fail. (Sam Phippen, #884)
190
+ * Fix `have_received(msg).with(args).exactly(n).times` and
191
+ `receive(msg).with(args).exactly(n).times` failure messages
192
+ for when the message was received the wrong number of times with
193
+ the specified args, and also received additional times with other
194
+ arguments. Previously it confusingly listed the arguments as being
195
+ mis-matched (even when the double was allowed to receive with any
196
+ args) rather than listing the count. (John Ceh, #918)
197
+ * Fix `any_args`/`anything` support so that we avoid calling `obj == anything`
198
+ on user objects that may have improperly implemented `==` in a way that
199
+ raises errors. (Myron Marston, #924)
200
+ * Fix edge case involving stubbing the same method on a class and a subclass
201
+ which previously hit a `NoMethodError` internally in RSpec. (Myron Marston #954)
202
+ * Fix edge case where the message received count would be incremented multiple
203
+ times for one failure. (Myron Marston, #957)
204
+ * Fix failure messages for when spies received the expected message with
205
+ different arguments and also received another message. (Maurício Linhares, #960)
206
+ * Silence whitespace-only diffs. (Myron Marston, #969)
207
+
208
+ ### 3.2.1 / 2015-02-23
209
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.2.0...v3.2.1)
210
+
211
+ Bug Fixes:
212
+
213
+ * Add missing `rspec/support/differ` require so that rspec-mocks can be
214
+ used w/o rspec-expectations (which also loads the differ and hided the
215
+ fact we forgot to require it). (Myron Marston, #893)
216
+ * Revert tracking of received arg mutation (added in 3.2.0 to provide an
217
+ error in a situation we can't support) as our implementation has side
218
+ effects on non-standard objects and there's no solution we could come
219
+ up with that always works. (Myron Marston, #900)
220
+
221
+ ### 3.2.0 / 2015-02-03
222
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.1.3...v3.2.0)
223
+
224
+ Enhancements:
225
+
226
+ * Treat `any_args` as an arg splat, allowing it to match an arbitrary
227
+ number of args at any point in an arg list. (Myron Marston, #786)
228
+ * Print diffs when arguments in mock expectations are mismatched.
229
+ (Sam Phippen, #751)
230
+ * Support names for verified doubles (`instance_double`, `instance_spy`,
231
+ `class_double`, `class_spy`, `object_double`, `object_spy`). (Cezary
232
+ Baginski, #826)
233
+ * Make `array_including` and `hash_including` argument matchers composable.
234
+ (Sam Phippen, #819)
235
+ * Make `allow_any_instance_of(...).to receive(...).and_wrap_original`
236
+ work. (Ryan Fitzgerald, #869)
237
+
238
+ Bug Fixes:
239
+
240
+ * Provide a clear error when users wrongly combine `no_args` with
241
+ additional arguments (e.g. `expect().to receive().with(no_args, 1)`).
242
+ (Myron Marston, #786)
243
+ * Provide a clear error when users wrongly use `any_args` multiple times in the
244
+ same argument list (e.g. `expect().to receive().with(any_args, 1, any_args)`.
245
+ (Myron Marston, #786)
246
+ * Prevent the error generator from using user object #description methods.
247
+ See [#685](https://github.com/rspec/rspec-mocks/issues/685).
248
+ (Sam Phippen, #751)
249
+ * Make verified doubles declared as `(instance|class)_double(SomeConst)`
250
+ work properly when `SomeConst` has previously been stubbed.
251
+ `(instance|class)_double("SomeClass")` already worked properly.
252
+ (Myron Marston, #824)
253
+ * Add a matcher description for `receive`, `receive_messages` and
254
+ `receive_message_chain`. (Myron Marston, #828)
255
+ * Validate invocation args for null object verified doubles.
256
+ (Myron Marston, #829)
257
+ * Fix `RSpec::Mocks::Constant.original` when called with an invalid
258
+ constant to return an object indicating the constant name is invalid,
259
+ rather than blowing up. (Myron Marston, #833)
260
+ * Make `extend RSpec::Mocks::ExampleMethods` on any object work properly
261
+ to add the rspec-mocks API to that object. Previously, `expect` would
262
+ be undefined. (Myron Marston, #846)
263
+ * Fix `require 'rspec/mocks/standalone'` so that it only affects `main`
264
+ and not every object. It's really only intended to be used in a REPL
265
+ like IRB, but some gems have loaded it, thinking it needs to be loaded
266
+ when using rspec-mocks outside the context of rspec-core.
267
+ (Myron Marston, #846)
268
+ * Prevent message expectations from being modified by customization methods
269
+ (e.g. `with`) after they have been invoked. (Sam Phippen and Melanie Gilman, #837)
270
+ * Handle cases where a method stub cannot be removed due to something
271
+ external to RSpec monkeying with the method definition. This can
272
+ happen, for example, when you `file.reopen(io)` after previously
273
+ stubbing a method on the `file` object. (Myron Marston, #853)
274
+ * Provide a clear error when received message args are mutated before
275
+ a `have_received(...).with(...)` expectation. (Myron Marston, #868)
276
+
277
+ ### 3.1.3 / 2014-10-08
278
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.1.2...v3.1.3)
279
+
280
+ Bug Fixes:
281
+
282
+ * Correct received messages count when used with `have_received` matcher.
283
+ (Jon Rowe, #793)
284
+ * Provide a clear error message when you use `allow_any_instance_of(...)` or
285
+ `expect_any_instance_of(...)` with the `have_received` matcher (they are
286
+ not intended to be used together and previously caused an odd internal
287
+ failure in rspec-mocks). (Jon Rowe, #799).
288
+ * Fix verified double `with` verification so that it applies to method
289
+ stubs. (Myron Marston, #790)
290
+
291
+ ### 3.1.2 / 2014-09-26
292
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.1.1...v3.1.2)
293
+
294
+ Bug Fixes:
295
+
296
+ * Provide a clear error message when you use `allow(...)` with the
297
+ `have_received` matcher (they are not intended to be used together
298
+ and previously caused an odd internal failure in rspec-mocks). (Jon Rowe, #788).
299
+
300
+ ### 3.1.1 / 2014-09-18
301
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.1.0...v3.1.1)
302
+
303
+ Bug Fixes:
304
+
305
+ * Prevent included modules being detected as prepended modules on Ruby 2.0
306
+ when using `any_instance_of(...)`. (Tony Novak, #781)
307
+
308
+ ### 3.1.0 / 2014-09-04
309
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.0.4...v3.1.0)
310
+
311
+ Enhancements:
312
+
313
+ * Add spying methods (`spy`, `ìnstance_spy`, `class_spy` and `object_spy`)
314
+ which create doubles as null objects for use with spying in testing. (Sam
315
+ Phippen, #671)
316
+ * `have_received` matcher will raise "does not implement" errors correctly when
317
+ used with verifying doubles and partial doubles. (Xavier Shay, #722)
318
+ * Allow matchers to be used in place of keyword arguments in `with`
319
+ expectations. (Xavier Shay, #726)
320
+ * Add `thrice` modifier to message expectation interface as a synonym
321
+ for `exactly(3).times`. (Dennis Taylor, #753)
322
+ * Add more `thrice` synonyms e.g. `.at_least(:thrice)`, `.at_most(:thrice)`,
323
+ `receive(...).thrice` and `have_received(...).thrice`. (Jon Rowe, #754)
324
+ * Add `and_wrap_original` modifier for partial doubles to mutate the
325
+ response from a method. (Jon Rowe, #762)
326
+
327
+ Bug Fixes:
328
+
329
+ * Remove `any_number_of_times` from `any_instance` recorders that were
330
+ erroneously causing mention of the method in documentation. (Jon Rowe, #760)
331
+ * Prevent included modules being detected as prepended modules on Ruby 2.0.
332
+ (Eugene Kenny, #771)
333
+
334
+ ### 3.0.4 / 2014-08-14
335
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.0.3...v3.0.4)
336
+
337
+ Bug Fixes:
338
+
339
+ * Restore `kind_of(x)` to match using `arg.kind_of?(x)` (like RSpec 2)
340
+ rather than `x === arg`. (Jon Rowe, #750)
341
+
342
+ ### 3.0.3 / 2014-07-21
343
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.0.2...v3.0.3)
344
+
345
+ Bug Fixes:
346
+
347
+ * `have_received` matcher will raise "does not implement" errors correctly when
348
+ used with verifying doubles and partial doubles. (Xavier Shay, #722)
349
+ * Make `double.as_null_object.dup` and `double.as_null_object.clone`
350
+ make the copies be null objects. (Myron Marston, #732)
351
+ * Don't inadvertently define `BasicObject` in 1.8.7. (Chris Griego, #739)
352
+
353
+ ### 3.0.2 / 2014-06-19
354
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.0.1...v3.0.2)
355
+
356
+ Bug Fixes:
357
+
358
+ * Fix edge case that triggered "can't add a new key into hash during
359
+ iteration" during mock verification. (Sam Phippen, Myron Marston, #711)
360
+ * Fix verifying doubles so that when they accidentally leak into another
361
+ example, they provide the same clear error message that normal doubles
362
+ do. (Myron Marston, #718)
363
+ * Make `ordered` work with exact receive counts. (Sam Phippen, #713)
364
+
365
+ ### 3.0.1 / 2014-06-07
366
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.0.0...v3.0.1)
367
+
368
+ Bug Fixes:
369
+
370
+ * Fix `receive_message_chain(...)` so that it supports `with` just like
371
+ `stub_chain` did. (Jon Rowe, #697)
372
+ * Fix regression in `expect_any_instance_of` so that it expects the
373
+ message on _any_ instance rather than on _every_ instance.
374
+ (Myron Marston, #699)
375
+
376
+ ### 3.0.0 / 2014-06-01
377
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.0.0.rc1...v3.0.0)
378
+
379
+ Bug Fixes:
380
+
381
+ * Fix module prepend detection to work properly on ruby 2.0 for a case
382
+ where a module is extended onto itself. (Myron Marston)
383
+ * Fix `transfer_nested_constants` option so that transferred constants
384
+ get properly reset at the end of the example. (Myron Marston)
385
+ * Fix `config.transfer_nested_constants = true` so that you don't
386
+ erroneously get errors when stubbing a constant that is not a module
387
+ or a class. (Myron Marston)
388
+ * Fix regression that caused `double(:class => SomeClass)` to later
389
+ trigger infinite recursion. (Myron Marston)
390
+ * Fix bug in `have_received(...).with(...).ordered` where it was not
391
+ taking the args into account when checking the order. (Myron Marston)
392
+ * Fix bug in `have_received(...).ordered` where it was wrongly
393
+ considering stubs when checking the order. (Myron Marston)
394
+ * Message expectation matchers now show descriptions from argument
395
+ matchers when their expectations aren't met. (Jon Rowe)
396
+ * Display warning when encountering `TypeError` during instance method
397
+ staging on 2.0.0-p195, suffers from https://bugs.ruby-lang.org/issues/8686
398
+ too. (Cezar Halmagean).
399
+
400
+ ### 3.0.0.rc1 / 2014-05-18
401
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.0.0.beta2...v3.0.0.rc1)
402
+
403
+ Breaking Changes for 3.0.0:
404
+
405
+ * Remove `RSpec::Mocks::TestDouble.extend_onto`. (Myron Marston)
406
+ * Remove `RSpec::Mocks::ConstantStubber`. (Jon Rowe)
407
+ * Make monkey-patch of Marshal to support dumping of stubbed objects opt-in.
408
+ (Xavier Shay)
409
+
410
+ Enhancements:
411
+
412
+ * Instead of crashing when cleaning up stub methods on a frozen object, it now
413
+ issues a warning explaining that it's impossible to clean up the stubs.
414
+ (Justin Coyne and Sam Phippen)
415
+ * Add meaningful descriptions to `anything`, `duck_type` and `instance_of` argument
416
+ matchers. (Jon Rowe)
417
+
418
+ Bug Fixes:
419
+
420
+ * Fix regression introduced in 3.0.0.beta2 that caused
421
+ `double.as_null_object.to_str` to return the double rather
422
+ than a string. (Myron Marston)
423
+ * Fix bug in `expect(dbl).to receive_message_chain(:foo, :bar)` where it was
424
+ not setting an expectation for the last message in the chain.
425
+ (Jonathan del Strother)
426
+ * Allow verifying partial doubles to have private methods stubbed. (Xavier Shay)
427
+ * Fix bug with allowing/expecting messages on Class objects which have had
428
+ their singleton class prepended to. (Jon Rowe)
429
+ * Fix an issue with 1.8.7 not running implementation blocks on partial doubles.
430
+ (Maurício Linhares)
431
+ * Prevent `StackLevelTooDeep` errors when stubbing an `any_instance` method that's
432
+ accessed in `inspect` by providing our own inspect output. (Jon Rowe)
433
+ * Fix bug in `any_instance` logic that did not allow you to mock or stub
434
+ private methods if `verify_partial_doubles` was configured. (Oren Dobzinski)
435
+ * Include useful error message when trying to observe an unimplemented method
436
+ on an any instance. (Xavier Shay)
437
+ * Fix `and_call_original` to work properly when multiple classes in an
438
+ inheritance hierarchy have been stubbed with the same method. (Myron Marston)
439
+ * Fix `any_instance` so that it updates existing instances that have
440
+ already been stubbed. (Myron Marston)
441
+ * Fix verified doubles so that their class name is included in failure
442
+ messages. (Myron Marston)
443
+ * Fix `expect_any_instance_of` so that when the message is received
444
+ on an individual instance that has been directly stubbed, it still
445
+ satisfies the expectation. (Sam Phippen, Myron Marston)
446
+ * Explicitly disallow using `any_instance` to mock or stub a method
447
+ that is defined on a module prepended onto the class. This triggered
448
+ `SystemStackError` before and is very hard to support so we are not
449
+ supporting it at this time. (Myron Marston)
450
+
451
+ ### 3.0.0.beta2 / 2014-02-17
452
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.0.0.beta1...v3.0.0.beta2)
453
+
454
+ Breaking Changes for 3.0.0:
455
+
456
+ * Rename `RSpec::Mocks::Mock` to `RSpec::Mocks::Double`. (Myron Marston)
457
+ * Change how to integrate rspec-mocks in other test frameworks. You now
458
+ need to include `RSpec::Mocks::ExampleMethods` in your test context.
459
+ (Myron Marston)
460
+ * Prevent RSpec mocks' doubles and partial doubles from being used outside of
461
+ the per-test lifecycle (e.g. from a `before(:all)` hook). (Sam Phippen)
462
+ * Remove the `host` argument of `RSpec::Mocks.setup`. Instead
463
+ `RSpec::Mocks::ExampleMethods` should be included directly in the scope where
464
+ RSpec's mocking capabilities are used. (Sam Phippen)
465
+ * Make test doubles raise errors if you attempt to use them after they
466
+ get reset, to help surface issues when you accidentally retain
467
+ references to test doubles and attempt to reuse them in another
468
+ example. (Myron Marston)
469
+ * Remove support for `and_return { value }` and `and_return` without arguments. (Yuji Nakayama)
470
+
471
+ Enhancements:
472
+
473
+ * Add `receive_message_chain` which provides the functionality of the old
474
+ `stub_chain` for the new allow/expect syntax. Use it like so: `allow(...).to
475
+ receive_message_chain(:foo, :bar, :bazz)`. (Sam Phippen).
476
+ * Change argument matchers to use `===` as their primary matching
477
+ protocol, since their semantics mirror that of a case or rescue statement
478
+ (which uses `===` for matching). (Myron Marston)
479
+ * Add `RSpec::Mocks.with_temporary_scope`, which allows you to create
480
+ temporary rspec-mocks scopes in arbitrary places (such as a
481
+ `before(:all)` hook). (Myron Marston)
482
+ * Support keyword arguments when checking arity with verifying doubles.
483
+ (Xavier Shay)
484
+
485
+ Bug Fixes:
486
+
487
+ * Fix regression in 3.0.0.beta1 that caused `double("string_name" => :value)`
488
+ to stop working. (Xavier Shay)
489
+ * Fix the way rspec-mocks and rspec-core interact so that if users
490
+ define a `let` with the same name as one of the methods
491
+ from `RSpec::Mocks::ArgumentMatchers`, the user's `let` takes
492
+ precedence. (Michi Huber, Myron Marston)
493
+ * Fix verified doubles so that their methods match the visibility
494
+ (public, protected or private) of the interface they verify
495
+ against. (Myron Marston)
496
+ * Fix verified null object doubles so that they do not wrongly
497
+ report that they respond to anything. They only respond to methods
498
+ available on the interface they verify against. (Myron Marston)
499
+ * Fix deprecation warning for use of old `:should` syntax w/o explicit
500
+ config so that it no longer is silenced by an extension gem such
501
+ as rspec-rails when it calls `config.add_stub_and_should_receive_to`.
502
+ (Sam Phippen)
503
+ * Fix `expect` syntax so that it does not wrongly emit a "You're
504
+ overriding a previous implementation for this stub" warning when
505
+ you are not actually doing that. (Myron Marston)
506
+ * Fix `any_instance.unstub` when used on sub classes for whom the super
507
+ class has had `any_instance.stub` invoked on. (Jon Rowe)
508
+ * Fix regression in `stub_chain`/`receive_message_chain` that caused
509
+ it to raise an `ArgumentError` when passing args to the stubbed
510
+ methods. (Sam Phippen)
511
+ * Correct stub of undefined parent modules all the way down when stubbing a
512
+ nested constant. (Xavier Shay)
513
+ * Raise `VerifyingDoubleNotDefinedError` when a constant is not defined for
514
+ a verifying class double. (Maurício Linhares)
515
+ * Remove `Double#to_str`, which caused confusing `raise some_double`
516
+ behavior. (Maurício Linhares)
517
+
518
+ ### 3.0.0.beta1 / 2013-11-07
519
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.4...v3.0.0.beta1)
520
+
521
+ Breaking Changes for 3.0.0:
522
+
523
+ * Raise an explicit error if `should_not_receive(...).and_return` is used. (Sam
524
+ Phippen)
525
+ * Remove 1.8.6 workarounds. (Jon Rowe)
526
+ * Remove `stub!` and `unstub!`. (Sam Phippen)
527
+ * Remove `mock(name, methods)` and `stub(name, methods)`, leaving
528
+ `double(name, methods)` for creating test doubles. (Sam Phippen, Michi Huber)
529
+ * Remove `any_number_of_times` since `should_receive(:msg).any_number_of_times`
530
+ is really a stub in a mock's clothing. (Sam Phippen)
531
+ * Remove support for re-using the same null-object test double in multiple
532
+ examples. Test doubles are designed to only live for one example.
533
+ (Myron Marston)
534
+ * Make `at_least(0)` raise an error. (Sam Phippen)
535
+ * Remove support for `require 'spec/mocks'` which had been kept
536
+ in place for backwards compatibility with RSpec 1. (Myron Marston)
537
+ * Blocks provided to `with` are always used as implementation. (Xavier Shay)
538
+ * The config option (added in 2.99) to yield the receiver to
539
+ `any_instance` implementation blocks now defaults to "on". (Sam Phippen)
540
+
541
+ Enhancements:
542
+
543
+ * Allow the `have_received` matcher to use a block to set further expectations
544
+ on arguments. (Tim Cowlishaw)
545
+ * Provide `instance_double` and `class_double` to create verifying doubles,
546
+ ported from `rspec-fire`. (Xavier Shay)
547
+ * `as_null_object` on a verifying double only responds to defined methods.
548
+ (Xavier Shay)
549
+ * Provide `object_double` to create verified doubles of specific object
550
+ instances. (Xavier Shay)
551
+ * Provide `verify_partial_doubles` configuration that provides `object_double`
552
+ like verification behaviour on partial doubles. (Xavier Shay)
553
+ * Improved performance of double creation, particularly those with many
554
+ attributes. (Xavier Shay)
555
+ * Default value of `transfer_nested_constants` option for constant stubbing can
556
+ be configured. (Xavier Shay)
557
+ * Messages can be allowed or expected on in bulk via
558
+ `receive_messages(:message => :value)`. (Jon Rowe)
559
+ * `allow(Klass.any_instance)` and `expect(Klass.any_instance)` now print a
560
+ warning. This is usually a mistake, and users usually want
561
+ `allow_any_instance_of` or `expect_any_instance_of` instead. (Sam Phippen)
562
+ * `instance_double` and `class_double` raise `ArgumentError` if the underlying
563
+ module is loaded and the arity of the method being invoked does not match the
564
+ arity of the method as it is actually implemented. (Andy Lindeman)
565
+ * Spies can now check their invocation ordering is correct. (Jon Rowe)
566
+
567
+ Deprecations:
568
+
569
+ * Using the old `:should` syntax without explicitly configuring it
570
+ is deprecated. It will continue to work but will emit a deprecation
571
+ warning in RSpec 3 if you do not explicitly enable it. (Sam Phippen)
572
+
573
+ Bug Fixes:
574
+
575
+ * Fix `and_call_original` to handle a complex edge case involving
576
+ singleton class ancestors. (Marc-André Lafortune, Myron Marston)
577
+ * When generating an error message for unexpected arguments,
578
+ use `#inspect` rather than `#description` if `#description`
579
+ returns `nil` or `''` so that you still get a useful message.
580
+ (Nick DeLuca)
581
+
582
+ ### 2.99.4 / 2015-06-19
583
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.3...v2.99.4)
584
+
585
+ Bug Fixes:
586
+
587
+ * Add missing deprecation for using `with` with no arguments e.g. `with()`. (Yousuke, #970)
588
+
589
+ ### 2.99.3 / 2015-01-09
590
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.2...v2.99.3)
591
+
592
+ Bug Fixes:
593
+
594
+ * Fix regression that caused an error when a test double was deserialized from YAML. (Yuji Nakayama, #777)
595
+
596
+ ### 2.99.2 / 2014-07-21
597
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.1...v2.99.2)
598
+
599
+ Enhancements:
600
+
601
+ * Warn about upcoming change to `#===` matching and `DateTime#===` behaviour.
602
+ (Jon Rowe, #735)
603
+
604
+ ### 2.99.1 / 2014-06-12
605
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.0...v2.99.1)
606
+
607
+ Bug Fixes:
608
+
609
+ * Fix bug that caused errors at the end of each example
610
+ when a `double.as_null_object` had been frozen. (Yuji Nakayama, #698)
611
+
612
+ Deprecations:
613
+
614
+ * Deprecate freezing a test double. (Yuji Nakayama, #698)
615
+
616
+ ### 2.99.0 / 2014-06-01
617
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.0.rc1...v2.99.0)
618
+
619
+ No changes. Just taking it out of pre-release.
620
+
621
+ ### 2.99.0.rc1 / 2014-05-18
622
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.0.beta2...v2.99.0.rc1)
623
+
624
+ Deprecations:
625
+
626
+ * Deprecate `RSpec::Mocks::TestDouble.extend_onto`. (Myron Marston)
627
+ * Deprecate `RSpec::Mocks::ConstantStubber`. (Jon Rowe)
628
+ * Deprecate `Marshal.dump` monkey-patch without opt-in. (Xavier Shay)
629
+
630
+ ### 2.99.0.beta2 / 2014-02-17
631
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.99.0.beta1...v2.99.0.beta2)
632
+
633
+ Deprecations:
634
+
635
+ * Deprecate `RSpec::Mocks::Mock` in favor of `RSpec::Mocks::Double`.
636
+ (Myron Marston)
637
+ * Deprecate the `host` argument of `RSpec::Mocks.setup`. Instead
638
+ `RSpec::Mocks::ExampleMethods` should be included directly in the scope where
639
+ RSpec's mocking capabilities are used. (Sam Phippen)
640
+ * Deprecate using any of rspec-mocks' features outside the per-test
641
+ lifecycle (e.g. from a `before(:all)` hook). (Myron Marston)
642
+ * Deprecate re-using a test double in another example. (Myron Marston)
643
+ * Deprecate `and_return { value }` and `and_return` without arguments. (Yuji Nakayama)
644
+
645
+ ### 2.99.0.beta1 / 2013-11-07
646
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.14.4...v2.99.0.beta1)
647
+
648
+ Deprecations
649
+
650
+ * Expecting to use lambdas or other strong arity implementations for stub
651
+ methods with mis-matched arity is deprecated and support for them will be
652
+ removed in 3.0. Either provide the right amount of arguments or use a weak
653
+ arity implementation (methods with splats or procs). (Jon Rowe)
654
+ * Using the same test double instance in multiple examples is deprecated. Test
655
+ doubles are only meant to live for one example. The mocks and stubs have
656
+ always been reset between examples; however, in 2.x the `as_null_object`
657
+ state was not reset and some users relied on this to have a null object
658
+ double that is used for many examples. This behavior will be removed in 3.0.
659
+ (Myron Marston)
660
+ * Print a detailed warning when an `any_instance` implementation block is used
661
+ when the new `yield_receiver_to_any_instance_implementation_blocks` config
662
+ option is not explicitly set, as RSpec 3.0 will default to enabling this new
663
+ feature. (Sam Phippen)
664
+
665
+ Enhancements:
666
+
667
+ * Add a config option to yield the receiver to `any_instance` implementation
668
+ blocks. (Sam Phippen)
669
+
670
+ ### 2.14.6 / 2014-02-20
671
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.14.5...v2.14.6)
672
+
673
+ Bug Fixes:
674
+
675
+ * Ensure `any_instance` method stubs and expectations are torn down regardless of
676
+ expectation failures. (Sam Phippen)
677
+
678
+ ### 2.14.5 / 2014-02-01
679
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.14.4...v2.14.5)
680
+
681
+ Bug Fixes:
682
+
683
+ * Fix regression that caused block implementations to not receive all
684
+ args on 1.8.7 if the block also receives a block, due to Proc#arity
685
+ reporting `1` no matter how many args the block receives if it
686
+ receives a block, too. (Myron Marston)
687
+
688
+ ### 2.14.4 / 2013-10-15
689
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.14.3...v2.14.4)
690
+
691
+ Bug Fixes:
692
+
693
+ * Fix issue where unstubing methods on "any instances" would not
694
+ remove stubs on existing instances (Jon Rowe)
695
+ * Fix issue with receive(:message) do ... end precedence preventing
696
+ the usage of modifications (`and_return` etc) (Jon Rowe)
697
+
698
+ ### 2.14.3 / 2013-08-08
699
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.14.2...v2.14.3)
700
+
701
+ Bug Fixes:
702
+
703
+ * Fix stubbing some instance methods for classes whose hierarchy includes
704
+ a prepended Module (Bradley Schaefer)
705
+
706
+ ### 2.14.2 / 2013-07-30
707
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.14.1...v2.14.2)
708
+
709
+ Bug Fixes:
710
+
711
+ * Fix `as_null_object` doubles so that they return `nil` from `to_ary`
712
+ (Jon Rowe).
713
+ * Fix regression in 2.14 that made `stub!` (with an implicit receiver)
714
+ return a test double rather than stub a method (Myron Marston).
715
+
716
+ ### 2.14.1 / 2013-07-07
717
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.14.0...v2.14.1)
718
+
719
+ Bug Fixes:
720
+
721
+ * Restore `double.as_null_object` behavior from 2.13 and earlier: a
722
+ double's nullness persisted between examples in earlier examples.
723
+ While this is not an intended use case (test doubles are meant to live
724
+ for only one example), we don't want to break behavior users rely
725
+ on in a minor relase. This will be deprecated in 2.99 and removed
726
+ in 3.0. (Myron Marston)
727
+
728
+ ### 2.14.0 / 2013-07-06
729
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.14.0.rc1...v2.14.0)
730
+
731
+ Enhancements:
732
+
733
+ * Document test spies in the readme. (Adarsh Pandit)
734
+ * Add an `array_including` matcher. (Sam Phippen)
735
+ * Add a syntax-agnostic API for mocking or stubbing a method. This is
736
+ intended for use by libraries such as rspec-rails that need to mock
737
+ or stub a method, and work regardless of the syntax the user has
738
+ configured (Paul Annesley, Myron Marston and Sam Phippen).
739
+
740
+ Bug Fixes:
741
+
742
+ * Fix `double` so that it sets up passed stubs correctly regardless of
743
+ the configured syntax (Paul Annesley).
744
+ * Allow a block implementation to be used in combination with
745
+ `and_yield`, `and_raise`, `and_return` or `and_throw`. This got fixed
746
+ in 2.13.1 but failed to get merged into master for the 2.14.0.rc1
747
+ release (Myron Marston).
748
+ * `Marshal.dump` does not unnecessarily duplicate objects when rspec-mocks has
749
+ not been fully initialized. This could cause errors when using `spork` or
750
+ similar preloading gems (Andy Lindeman).
751
+
752
+ ### 2.14.0.rc1 / 2013-05-27
753
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.13.0...v2.14.0.rc1)
754
+
755
+ Enhancements:
756
+
757
+ * Refactor internals so that the mock proxy methods and state are held
758
+ outside of the mocked object rather than inside it. This paves the way
759
+ for future syntax enhancements and removes the need for some hacky
760
+ work arounds for `any_instance` dup'ing and `YAML` serialization,
761
+ among other things. Note that the code now relies upon `__id__`
762
+ returning a unique, consistent value for any object you want to
763
+ mock or stub (Myron Marston).
764
+ * Add support for test spies. This allows you to verify a message
765
+ was received afterwards using the `have_received` matcher.
766
+ Note that you must first stub the method or use a null double.
767
+ (Joe Ferris and Joël Quenneville)
768
+ * Make `at_least` and `at_most` style receive expectations print that they were
769
+ expecting at least or at most some number of calls, rather than just the
770
+ number of calls given in the expectation (Sam Phippen)
771
+ * Make `with` style receive expectations print the args they were expecting, and
772
+ the args that they got (Sam Phippen)
773
+ * Fix some warnings seen under ruby 2.0.0p0 (Sam Phippen).
774
+ * Add a new `:expect` syntax for message expectations
775
+ (Myron Marston and Sam Phippen).
776
+
777
+ Bug fixes
778
+
779
+ * Fix `any_instance` so that a frozen object can be `dup`'d when methods
780
+ have been stubbed on that type using `any_instance` (Jon Rowe).
781
+ * Fix `and_call_original` so that it properly raises an `ArgumentError`
782
+ when the wrong number of args are passed (Jon Rowe).
783
+ * Fix `double` on 1.9.2 so you can wrap them in an Array
784
+ using `Array(my_double)` (Jon Rowe).
785
+ * Fix `stub_const` and `hide_const` to handle constants that redefine `send`
786
+ (Sam Phippen).
787
+ * Fix `Marshal.dump` extension so that it correctly handles nil.
788
+ (Luke Imhoff, Jon Rowe)
789
+ * Fix isolation of `allow_message_expectations_on_nil` (Jon Rowe)
790
+ * Use inspect to format actual arguments on expectations in failure messages (#280, Ben Langfeld)
791
+ * Protect against improperly initialised test doubles (#293) (Joseph Shraibman and Jon Rowe)
792
+
793
+ Deprecations
794
+
795
+ * Deprecate `stub` and `mock` as aliases for `double`. `double` is the
796
+ best term for creating a test double, and it reduces confusion to
797
+ have only one term (Michi Huber).
798
+ * Deprecate `stub!` and `unstub!` in favor of `stub` and `unstub`
799
+ (Jon Rowe).
800
+ * Deprecate `at_least(0).times` and `any_number_of_times` (Michi Huber).
801
+
802
+ ### 2.13.1 / 2013-04-06
803
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.13.0...v2.13.1)
804
+
805
+ Bug fixes
806
+
807
+ * Allow a block implementation to be used in combination with
808
+ `and_yield`, `and_raise`, `and_return` or `and_throw` (Myron Marston).
809
+
810
+ ### 2.13.0 / 2013-02-23
811
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.12.2...v2.13.0)
812
+
813
+ Bug fixes
814
+
815
+ * Fix bug that caused weird behavior when a method that had
816
+ previously been stubbed with multiple return values (e.g.
817
+ `obj.stub(:foo).and_return(1, 2)`) was later mocked with a
818
+ single return value (e.g. `obj.should_receive(:foo).once.and_return(1)`).
819
+ (Myron Marston)
820
+ * Fix bug related to a mock expectation for a method that already had
821
+ multiple stubs with different `with` constraints. Previously, the
822
+ first stub was used, even though it may not have matched the passed
823
+ args. The fix defers this decision until the message is received so
824
+ that the proper stub response can be chosen based on the passed
825
+ arguments (Myron Marston).
826
+ * Do not call `nil?` extra times on a mocked object, in case `nil?`
827
+ itself is expected a set number of times (Myron Marston).
828
+ * Fix `missing_default_stub_error` message so array args are handled
829
+ properly (Myron Marston).
830
+ * Explicitly disallow `any_instance.unstub!` (Ryan Jones).
831
+ * Fix `any_instance` stubbing so that it works with `Delegator`
832
+ subclasses (Myron Marston).
833
+ * Fix `and_call_original` so that it works with `Delegator` subclasses
834
+ (Myron Marston).
835
+ * Fix `any_instance.should_not_receive` when `any_instance.should_receive`
836
+ is used on the same class in the same example. Previously it would
837
+ wrongly report a failure even when the message was not received
838
+ (Myron Marston).
839
+
840
+ ### 2.12.2 / 2013-01-27
841
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.12.1...v.2.12.2)
842
+
843
+ Bug fixes
844
+
845
+ * Fix `and_call_original` to work properly for methods defined
846
+ on a module extended onto an object instance (Myron Marston).
847
+ * Fix `stub_const` with an undefined constnat name to work properly
848
+ with constant strings that are prefixed with `::` -- and edge case
849
+ I missed in the bug fix in the 2.12.1 release (Myron Marston).
850
+ * Ensure method visibility on a partial mock is restored after reseting
851
+ method stubs, even on a singleton module (created via `extend self`)
852
+ when the method visibility differs between the instance and singleton
853
+ versions (Andy Lindeman).
854
+
855
+ ### 2.12.1 / 2012-12-21
856
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.12.0...v2.12.1)
857
+
858
+ Bug fixes
859
+
860
+ * Fix `any_instance` to support `and_call_original`.
861
+ (Myron Marston)
862
+ * Properly restore stubbed aliased methods on rubies
863
+ that report the incorrect owner (Myron Marston and Andy Lindeman).
864
+ * Fix `hide_const` and `stub_const` with a defined constnat name to
865
+ work properly with constant strings that are prefixed with `::` (Myron Marston).
866
+
867
+ ### 2.12.0 / 2012-11-12
868
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.11.3...v2.12.0)
869
+
870
+ Enhancements
871
+
872
+ * `and_raise` can accept an exception class and message, more closely
873
+ matching `Kernel#raise` (e.g., `foo.stub(:bar).and_raise(RuntimeError, "message")`)
874
+ (Bas Vodde)
875
+ * Add `and_call_original`, which will delegate the message to the
876
+ original method (Myron Marston).
877
+
878
+ Deprecations:
879
+
880
+ * Add deprecation warning when using `and_return` with `should_not_receive`
881
+ (Neha Kumari)
882
+
883
+ ### 2.11.3 / 2012-09-19
884
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.11.2...v2.11.3)
885
+
886
+ Bug fixes
887
+
888
+ * Fix `:transfer_nested_constants` option of `stub_const` so that it
889
+ doesn't blow up when there are inherited constants. (Myron Marston)
890
+ * `any_instance` stubs can be used on classes that override `Object#method`.
891
+ (Andy Lindeman)
892
+ * Methods stubbed with `any_instance` are unstubbed after the test finishes.
893
+ (Andy Lindeman)
894
+ * Fix confusing error message when calling a mocked class method an
895
+ extra time with the wrong arguments (Myron Marston).
896
+
897
+ ### 2.11.2 / 2012-08-11
898
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.11.1...v2.11.2)
899
+
900
+ Bug fixes
901
+
902
+ * Don't modify `dup` on classes that don't support `dup` (David Chelimsky)
903
+ * Fix `any_instance` so that it works properly with methods defined on
904
+ a superclass. (Daniel Eguzkiza)
905
+ * Fix `stub_const` so that it works properly for nested constants that
906
+ share a name with a top-level constant (e.g. "MyGem::Hash"). (Myron
907
+ Marston)
908
+
909
+ ### 2.11.1 / 2012-07-09
910
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.11.0...v2.11.1)
911
+
912
+ Bug fixes
913
+
914
+ * Fix `should_receive` so that when it is called on an `as_null_object`
915
+ double with no implementation, and there is a previous explicit stub
916
+ for the same method, the explicit stub remains (rather than being
917
+ overridden with the null object implementation--`return self`). (Myron
918
+ Marston)
919
+
920
+ ### 2.11.0 / 2012-07-07
921
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.10.1...v2.11.0)
922
+
923
+ Enhancements
924
+
925
+ * Expose ArgumentListMatcher as a formal API
926
+ * supports use by 3rd party mock frameworks like Surrogate
927
+ * Add `stub_const` API to stub constants for the duration of an
928
+ example (Myron Marston).
929
+
930
+ Bug fixes
931
+
932
+ * Fix regression of edge case behavior. `double.should_receive(:foo) { a }`
933
+ was causing a NoMethodError when `double.stub(:foo).and_return(a, b)`
934
+ had been setup before (Myron Marston).
935
+ * Infinite loop generated by using `any_instance` and `dup`. (Sidu Ponnappa @kaiwren)
936
+ * `double.should_receive(:foo).at_least(:once).and_return(a)` always returns a
937
+ even if `:foo` is already stubbed.
938
+ * Prevent infinite loop when interpolating a null double into a string
939
+ as an integer (`"%i" % double.as_null_object`). (Myron Marston)
940
+ * Fix `should_receive` so that null object behavior (e.g. returning
941
+ self) is preserved if no implementation is given (Myron Marston).
942
+ * Fix `and_raise` so that it raises `RuntimeError` rather than
943
+ `Exception` by default, just like ruby does. (Andrew Marshall)
944
+
945
+ ### 2.10.1 / 2012-05-05
946
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.10.0...v2.10.1)
947
+
948
+ Bug fixes
949
+
950
+ * fix regression of edge case behavior
951
+ (https://github.com/rspec/rspec-mocks/issues/132)
952
+ * fixed failure of `object.should_receive(:message).at_least(0).times.and_return value`
953
+ * fixed failure of `object.should_not_receive(:message).and_return value`
954
+
955
+ ### 2.10.0 / 2012-05-03
956
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.9.0...v2.10.0)
957
+
958
+ Bug fixes
959
+
960
+ * fail fast when an `exactly` or `at_most` expectation is exceeded
961
+
962
+ ### 2.9.0 / 2012-03-17
963
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.8.0...v2.9.0)
964
+
965
+ Enhancements
966
+
967
+ * Support order constraints across objects (preethiramdev)
968
+
969
+ Bug fixes
970
+
971
+ * Allow a `as_null_object` to be passed to `with`
972
+ * Pass proc to block passed to stub (Aubrey Rhodes)
973
+ * Initialize child message expectation args to match any args (#109 -
974
+ preethiramdev)
975
+
976
+ ### 2.8.0 / 2012-01-04
977
+
978
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.8.0.rc2...v2.8.0)
979
+
980
+ No changes for this release. Just releasing with the other rspec gems.
981
+
982
+ ### 2.8.0.rc2 / 2011-12-19
983
+
984
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.8.0.rc1...v2.8.0.rc2)
985
+
986
+ No changes for this release. Just releasing with the other rspec gems.
987
+
988
+ ### 2.8.0.rc1 / 2011-11-06
989
+
990
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.7.0...v2.8.0.rc1)
991
+
992
+ Enhancements
993
+
994
+ * Eliminate Ruby warnings (Matijs van Zuijlen)
995
+
996
+ ### 2.7.0 / 2011-10-16
997
+
998
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.6.0...v2.7.0)
999
+
1000
+ Enhancements
1001
+
1002
+ * Use `__send__` rather than `send` (alextk)
1003
+ * Add support for `any_instance.stub_chain` (Sidu Ponnappa)
1004
+ * Add support for `any_instance` argument matching based on `with` (Sidu
1005
+ Ponnappa and Andy Lindeman)
1006
+
1007
+ Changes
1008
+
1009
+ * Check for `failure_message_for_should` or `failure_message` instead of
1010
+ `description` to detect a matcher (Tibor Claassen)
1011
+
1012
+ Bug fixes
1013
+
1014
+ * pass a hash to `any_instance.stub`. (Justin Ko)
1015
+ * allow `to_ary` to be called without raising `NoMethodError` (Mikhail
1016
+ Dieterle)
1017
+ * `any_instance` properly restores private methods (Sidu Ponnappa)
1018
+
1019
+ ### 2.6.0 / 2011-05-12
1020
+
1021
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.5.0...v2.6.0)
1022
+
1023
+ Enhancements
1024
+
1025
+ * Add support for `any_instance.stub` and `any_instance.should_receive` (Sidu
1026
+ Ponnappa and Andy Lindeman)
1027
+
1028
+ Bug fixes
1029
+
1030
+ * fix bug in which multiple chains with shared messages ending in hashes failed
1031
+ to return the correct value
1032
+
1033
+ ### 2.5.0 / 2011-02-05
1034
+
1035
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.4.0...v2.5.0)
1036
+
1037
+ Bug fixes
1038
+
1039
+ * message expectation counts now work in combination with a stub (Damian
1040
+ Nurzynski)
1041
+ * fix failure message when message received with incorrect args (Josep M.
1042
+ Bach)
1043
+
1044
+ ### 2.4.0 / 2011-01-02
1045
+
1046
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.3.0...v2.4.0)
1047
+
1048
+ No functional changes in this release, which was made to align with the
1049
+ rspec-core-2.4.0 release.
1050
+
1051
+ ### 2.3.0 / 2010-12-12
1052
+
1053
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.2.0...v2.3.0)
1054
+
1055
+ Bug fixes
1056
+
1057
+ * Fix our Marshal extension so that it does not interfere with objects that
1058
+ have their own `@mock_proxy` instance variable. (Myron Marston)
1059
+
1060
+ ### 2.2.0 / 2010-11-28
1061
+
1062
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.1.0...v2.2.0)
1063
+
1064
+ Enhancements
1065
+
1066
+ * Added "rspec/mocks/standalone" for exploring the rspec-mocks in irb.
1067
+
1068
+ Bug fix
1069
+
1070
+ * Eliminate warning on splat args without parens (Gioele Barabucci)
1071
+ * Fix bug where `obj.should_receive(:foo).with(stub.as_null_object)` would pass
1072
+ with a false positive.
1073
+
1074
+ ### 2.1.0 / 2010-11-07
1075
+
1076
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.0.1...v2.1.0)
1077
+
1078
+ Bug fixes
1079
+
1080
+ * Fix serialization of stubbed object (Josep M Bach)
1081
+
1082
+ ### 2.0.0 / 2010-10-10
1083
+
1084
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.0.0.beta.22...v2.0.0)
1085
+
1086
+ ### 2.0.0.rc / 2010-10-05
1087
+
1088
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.0.0.beta.22...v2.0.0.rc)
1089
+
1090
+ Enhancements
1091
+
1092
+ * support passing a block to an expectation block (Nicolas Braem)
1093
+ * `obj.should_receive(:msg) {|&block| ... }`
1094
+
1095
+ Bug fixes
1096
+
1097
+ * Fix YAML serialization of stub (Myron Marston)
1098
+ * Fix rdoc rake task (Hans de Graaff)
1099
+
1100
+ ### 2.0.0.beta.22 / 2010-09-12
1101
+
1102
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.0.0.beta.20...v2.0.0.beta.22)
1103
+
1104
+ Bug fixes
1105
+
1106
+ * fixed regression that broke `obj.stub_chain(:a, :b => :c)`
1107
+ * fixed regression that broke `obj.stub_chain(:a, :b) { :c }`
1108
+ * `respond_to?` always returns true when using `as_null_object`