rspec-mocks 2.11.3 → 3.11.1

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