rspec-mocks 3.8.2

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