rspec-expectations 3.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +5 -0
  4. data/.document +5 -0
  5. data/.yardopts +6 -0
  6. data/Changelog.md +1156 -0
  7. data/LICENSE.md +25 -0
  8. data/README.md +305 -0
  9. data/lib/rspec/expectations.rb +82 -0
  10. data/lib/rspec/expectations/block_snippet_extractor.rb +253 -0
  11. data/lib/rspec/expectations/configuration.rb +215 -0
  12. data/lib/rspec/expectations/expectation_target.rb +127 -0
  13. data/lib/rspec/expectations/fail_with.rb +39 -0
  14. data/lib/rspec/expectations/failure_aggregator.rb +194 -0
  15. data/lib/rspec/expectations/handler.rb +170 -0
  16. data/lib/rspec/expectations/minitest_integration.rb +58 -0
  17. data/lib/rspec/expectations/syntax.rb +132 -0
  18. data/lib/rspec/expectations/version.rb +8 -0
  19. data/lib/rspec/matchers.rb +1034 -0
  20. data/lib/rspec/matchers/aliased_matcher.rb +116 -0
  21. data/lib/rspec/matchers/built_in.rb +52 -0
  22. data/lib/rspec/matchers/built_in/all.rb +86 -0
  23. data/lib/rspec/matchers/built_in/base_matcher.rb +193 -0
  24. data/lib/rspec/matchers/built_in/be.rb +288 -0
  25. data/lib/rspec/matchers/built_in/be_between.rb +77 -0
  26. data/lib/rspec/matchers/built_in/be_instance_of.rb +26 -0
  27. data/lib/rspec/matchers/built_in/be_kind_of.rb +20 -0
  28. data/lib/rspec/matchers/built_in/be_within.rb +72 -0
  29. data/lib/rspec/matchers/built_in/change.rb +428 -0
  30. data/lib/rspec/matchers/built_in/compound.rb +271 -0
  31. data/lib/rspec/matchers/built_in/contain_exactly.rb +302 -0
  32. data/lib/rspec/matchers/built_in/cover.rb +24 -0
  33. data/lib/rspec/matchers/built_in/eq.rb +40 -0
  34. data/lib/rspec/matchers/built_in/eql.rb +34 -0
  35. data/lib/rspec/matchers/built_in/equal.rb +81 -0
  36. data/lib/rspec/matchers/built_in/exist.rb +90 -0
  37. data/lib/rspec/matchers/built_in/has.rb +103 -0
  38. data/lib/rspec/matchers/built_in/have_attributes.rb +114 -0
  39. data/lib/rspec/matchers/built_in/include.rb +149 -0
  40. data/lib/rspec/matchers/built_in/match.rb +106 -0
  41. data/lib/rspec/matchers/built_in/operators.rb +128 -0
  42. data/lib/rspec/matchers/built_in/output.rb +200 -0
  43. data/lib/rspec/matchers/built_in/raise_error.rb +230 -0
  44. data/lib/rspec/matchers/built_in/respond_to.rb +165 -0
  45. data/lib/rspec/matchers/built_in/satisfy.rb +60 -0
  46. data/lib/rspec/matchers/built_in/start_or_end_with.rb +94 -0
  47. data/lib/rspec/matchers/built_in/throw_symbol.rb +132 -0
  48. data/lib/rspec/matchers/built_in/yield.rb +432 -0
  49. data/lib/rspec/matchers/composable.rb +171 -0
  50. data/lib/rspec/matchers/dsl.rb +527 -0
  51. data/lib/rspec/matchers/english_phrasing.rb +58 -0
  52. data/lib/rspec/matchers/expecteds_for_multiple_diffs.rb +73 -0
  53. data/lib/rspec/matchers/fail_matchers.rb +42 -0
  54. data/lib/rspec/matchers/generated_descriptions.rb +41 -0
  55. data/lib/rspec/matchers/matcher_delegator.rb +35 -0
  56. data/lib/rspec/matchers/matcher_protocol.rb +99 -0
  57. metadata +215 -0
  58. metadata.gz.sig +0 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d1f0c43e7a6933605f4b96eb0a5545bd5e1b03a2b2de4471edada5000f3c5c37
4
+ data.tar.gz: 62b85e7625d066114174dfaa586dbb2cb419aa0bc470b68918c2524b841f8762
5
+ SHA512:
6
+ metadata.gz: 5ba237ec4317b7af0780f5e929e10da26b501f76a23cb807684498a21118ef0f72598c1ded7ee0436a8a29f97ea16a0d4f887c7b345b22302f5b8ef50c660beb
7
+ data.tar.gz: 4138b8b208b668216660d55f5634440e8240c4a36f15489fc3e1e6093d4a8530fc419d9f958ea4526ac63e7e9e2d589c7716a21832d257adac823486d5dfae77
Binary file
@@ -0,0 +1,5 @@
1
+ p]���[���03$�i��
2
+ �6s���1ϑ�x ����6n�������7�u��
3
+ "�l����@򣙅!;E��(c}=>8�a���Br {�� 5�����e�����?O�7�Q�����g� f�Ip+�H;m�-�#\ �d�uZ�7�����8s�kug��2G+'1m')�V�����L�5^(�����L�0F�b8q��੦h�T�:�X�zB-тϳ.(��A������q}&b̟o����&�e�+��C��ø.��c���9|v��)h��C*�6،�� d۳
4
+ h�{�Q�'���l�F׈�7��������h��)#g����{�\�u9&��M�����l��
5
+ �a���$<�|�} 5�������}S�#��KW#c-�r� ����t~�O�+T[���#H�X�,&��)��^�!�ٓڿr��������� ���}��=dk<�N�"3��u�\�22��8Y��' �M [�i�T�ɚ �|?
@@ -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,1156 @@
1
+ ### 3.8.6 / 2019-10-07
2
+
3
+ Bug Fixes:
4
+
5
+ * Revert #1125 due to the change being incompatible with our semantic versioning
6
+ policy.
7
+
8
+ ### 3.8.5 / 2019-10-02
9
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.4...v3.8.5)
10
+
11
+ Bug Fixes:
12
+
13
+ * Prevent unsupported implicit block expectation syntax from being used.
14
+ (Phil Pirozhkov, #1125)
15
+
16
+ ### 3.8.4 / 2019-06-10
17
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.3...v3.8.4)
18
+
19
+ Bug Fixes:
20
+
21
+ * Prevent false negatives when checking objects for the methods required to run the
22
+ the `be_an_instance_of` and `be_kind_of` matchers. (Nazar Matus, #1112)
23
+
24
+ ### 3.8.3 / 2019-04-20
25
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.2...v3.8.3)
26
+
27
+ Bug Fixes:
28
+
29
+ * Prevent composed `all` matchers from leaking into their siblings leading to duplicate
30
+ failures. (Jamie English, #1086)
31
+ * Prevent objects which change their hash on comparison from failing change checks.
32
+ (Phil Pirozhkov, #1110)
33
+ * Issue an `ArgumentError` rather than a `NoMethodError` when `be_an_instance_of` and
34
+ `be_kind_of` matchers encounter objects not supporting those methods.
35
+ (Taichi Ishitani, #1107)
36
+
37
+ ### 3.8.2 / 2018-10-09
38
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.1...v3.8.2)
39
+
40
+ Bug Fixes:
41
+
42
+ * Change `include` matcher to rely on a `respond_to?(:include?)` check rather than a direct
43
+ Hash comparison before calling `to_hash` to convert to a hash. (Jordan Owens, #1073)
44
+ * Prevent unexpected call stack jumps from causing an obscure error (`IndexError`), and
45
+ replace that error with a proper informative message. (Jon Rowe, #1076)
46
+
47
+ ### 3.8.1 / 2018-08-06
48
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.0...v3.8.1)
49
+
50
+ Bug Fixes:
51
+
52
+ * Fix regression in `include` matcher so stopped
53
+ `expect(hash.with_indifferent_access).to include(:symbol_key)`
54
+ from working. (Eito Katagiri, #1069)
55
+
56
+ ### 3.8.0 / 2018-08-04
57
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.7.0...v3.8.0)
58
+
59
+ Enhancements:
60
+
61
+ * Improve failure message of `change(receiver, :message)` by including the
62
+ receiver as `SomeClass#some_message`. (Tomohiro Hashidate, #1005)
63
+ * Improve `change` matcher so that it can correctly detect changes in
64
+ deeply nested mutable objects (such as arrays-of-hashes-of-arrays).
65
+ The improved logic uses the before/after `hash` value to see if the
66
+ object has been mutated, rather than shallow duping the object.
67
+ (Myron Marston, #1034)
68
+ * Improve `include` matcher so that pseudo-hash objects (e.g. objects
69
+ that decorate a hash using a `SimpleDelegator` or similar) are treated
70
+ as a hash, as long as they implement `to_hash`. (Pablo Brasero, #1012)
71
+ * Add `max_formatted_output_length=` to configuration, allowing changing
72
+ the length at which we truncate large output strings.
73
+ (Sam Phippen #951, Benoit Tigeot #1056)
74
+ * Improve error message when passing a matcher that doesn't support block
75
+ expectations to a block based `expect`. (@nicktime, #1066)
76
+
77
+ ### 3.7.0 / 2017-10-17
78
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.6.0...v3.7.0)
79
+
80
+ Enhancements:
81
+
82
+ * Improve compatibility with `--enable-frozen-string-literal` option
83
+ on Ruby 2.3+. (Pat Allan, #997)
84
+
85
+ ### 3.6.0 / 2017-05-04
86
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.6.0.beta2...v3.6.0)
87
+
88
+ Enhancements:
89
+
90
+ * Treat NoMethodError as a failure for comparison matchers. (Jon Rowe, #972)
91
+ * Allow for scoped aliased and negated matchers--just call
92
+ `alias_matcher` or `define_negated_matcher` from within an example
93
+ group. (Markus Reiter, #974)
94
+ * Improve failure message of `change` matcher with block and `satisfy` matcher
95
+ by including the block snippet instead of just describing it as `result` or
96
+ `block` when Ripper is available. (Yuji Nakayama, #987)
97
+
98
+ Bug Fixes:
99
+
100
+ * Fix `yield_with_args` and `yield_successive_args` matchers so that
101
+ they compare expected to actual args at the time the args are yielded
102
+ instead of at the end, in case the method that is yielding mutates the
103
+ arguments after yielding. (Alyssa Ross, #965)
104
+
105
+ ### 3.6.0.beta2 / 2016-12-12
106
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.6.0.beta1...v3.6.0.beta2)
107
+
108
+ Bug Fixes:
109
+
110
+ * Using the exist matcher on `File` no longer produces a deprecation warning.
111
+ (Jon Rowe, #954)
112
+
113
+ ### 3.6.0.beta1 / 2016-10-09
114
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0...v3.6.0.beta1)
115
+
116
+ Bug Fixes:
117
+
118
+ * Fix `contain_exactly` to work correctly with ranges. (Myron Marston, #940)
119
+ * Fix `change` to work correctly with sets. (Marcin Gajewski, #939)
120
+
121
+ ### 3.5.0 / 2016-07-01
122
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0.beta4...v3.5.0)
123
+
124
+ Enhancements:
125
+
126
+ * Add support for keyword arguments to the `respond_to` matcher. (Rob Smith, #915).
127
+
128
+ ### 3.5.0.beta4 / 2016-06-05
129
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0.beta3...v3.5.0.beta4)
130
+
131
+ Bug Fixes:
132
+
133
+ * Fix `include` matcher so that it provides a valid diff for hashes. (Yuji Nakayama, #916)
134
+
135
+ ### 3.5.0.beta3 / 2016-04-02
136
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0.beta2...v3.5.0.beta3)
137
+
138
+ Enhancements:
139
+
140
+ * Make `rspec/expectations/minitest_integration` work on Minitest::Spec
141
+ 5.6+. (Myron Marston, #904)
142
+ * Add an alias `having_attributes` for `have_attributes` matcher.
143
+ (Yuji Nakayama, #905)
144
+ * Improve `change` matcher error message when block is mis-used.
145
+ (Alex Altair, #908)
146
+
147
+ ### 3.5.0.beta2 / 2016-03-10
148
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0.beta1...v3.5.0.beta2)
149
+
150
+ Enhancements:
151
+
152
+ * Add the ability to raise an error on encountering false positives via
153
+ `RSpec::Configuration#on_potential_false_positives = :raise`. (Jon Rowe, #900)
154
+ * When using the custom matcher DSL, support new
155
+ `notify_expectation_failures: true` option for the `match` method to
156
+ allow expectation failures to be raised as normal instead of being
157
+ converted into a `false` return value for `matches?`. (Jon Rowe, #892)
158
+
159
+ Bug Fixes:
160
+
161
+ * Allow `should` deprecation check to work on `BasicObject`s. (James Coleman, #898)
162
+
163
+ ### 3.5.0.beta1 / 2016-02-06
164
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.4.0...v3.5.0.beta1)
165
+
166
+ Enhancements:
167
+
168
+ * Make `match_when_negated` in custom matcher DSL support use of
169
+ expectations within the match logic. (Chris Arcand, #789)
170
+
171
+ Bug Fixes:
172
+
173
+ * Return `true` as expected from passing negated expectations
174
+ (such as `expect("foo").not_to eq "bar"`), so they work
175
+ properly when used within a `match` or `match_when_negated`
176
+ block. (Chris Arcand, #789)
177
+
178
+ ### 3.4.0 / 2015-11-11
179
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.3.1...v3.4.0)
180
+
181
+ Enhancements:
182
+
183
+ * Warn when `RSpec::Matchers` is included in a superclass after it has
184
+ already been included in a subclass on MRI 1.9, since that situation
185
+ can cause uses of `super` to trigger infinite recursion. (Myron Marston, #816)
186
+ * Stop rescuing `NoMemoryError`, `SignalExcepetion`, `Interrupt` and
187
+ `SystemExit`. It is dangerous to interfere with these. (Myron Marston, #845)
188
+ * Add `#with_captures` to the
189
+ [match matcher](https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers/match-matcher)
190
+ which allows a user to specify expected captures when matching a regex
191
+ against a string. (Sam Phippen, #848)
192
+ * Always print compound failure messages in the multi-line form. Trying
193
+ to print it all on a single line didn't read very well. (Myron Marston, #859)
194
+
195
+ Bug Fixes:
196
+
197
+ * Fix failure message from dynamic predicate matchers when the object
198
+ does not respond to the predicate so that it is inspected rather
199
+ than relying upon its `to_s` -- that way for `nil`, `"nil"` is
200
+ printed rather than an empty string. (Myron Marston, #841)
201
+ * Fix SystemStackError raised when diffing an Enumerable object
202
+ whose `#each` includes the object itself. (Yuji Nakayama, #857)
203
+
204
+ ### 3.3.1 / 2015-07-15
205
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.3.0...v3.3.1)
206
+
207
+ Bug Fixes:
208
+
209
+ * Fix `be >`, `be <`, etc so that it fails rather than allowing an
210
+ argument error to be raised when compared against an object of the
211
+ wrong type. This allows it to be used in composed matcher expressions
212
+ against heterogeneous objects. (Dennis Günnewig, #809)
213
+ * Fix `respond_to` to work properly on target objects
214
+ that redefine the `method` method. (unmanbearpig, #821)
215
+
216
+ ### 3.3.0 / 2015-06-12
217
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.2.1...v3.3.0)
218
+
219
+ Enhancements:
220
+
221
+ * Expose `RSpec::Matchers::EnglishPhrasing` to make it easier to write
222
+ nice failure messages in custom matchers. (Jared Beck, #736)
223
+ * Add `RSpec::Matchers::FailMatchers`, a mixin which provides
224
+ `fail`, `fail_with` and `fail_including` matchers for use in
225
+ specifying that an expectation fails for use by
226
+ extension/plugin authors. (Charlie Rudolph, #729)
227
+ * Avoid loading `tempfile` (and its dependencies) unless
228
+ it is absolutely needed. (Myron Marston, #735)
229
+ * Improve failure output when attempting to use `be_true` or `be_false`.
230
+ (Tim Wade, #744)
231
+ * Define `RSpec::Matchers#respond_to_missing?` so that
232
+ `RSpec::Matchers#respond_to?` and `RSpec::Matchers#method` handle
233
+ dynamic predicate matchers. (Andrei Botalov, #751)
234
+ * Use custom Time/DateTime/BigDecimal formatting for all matchers
235
+ so they are consistently represented in failure messages.
236
+ (Gavin Miller, #740)
237
+ * Add configuration to turn off warnings about matcher combinations that
238
+ may cause false positives. (Jon Rowe, #768)
239
+ * Warn when using a bare `raise_error` matcher that you may be subject to
240
+ false positives. (Jon Rowe, #768)
241
+ * Warn rather than raise when using the`raise_error` matcher in negative
242
+ expectations that may be subject to false positives. (Jon Rowe, #775)
243
+ * Improve failure message for `include(a, b, c)` so that if `a` and `b`
244
+ are included the failure message only mentions `c`. (Chris Arcand, #780)
245
+ * Allow `satisfy` matcher to take an optional description argument
246
+ that will be used in the `description`, `failure_message` and
247
+ `failure_message_when_negated` in place of the undescriptive
248
+ "sastify block". (Chris Arcand, #783)
249
+ * Add new `aggregate_failures` API that allows multiple independent
250
+ expectations to all fail and be listed in the failure output, rather
251
+ than the example aborting on the first failure. (Myron Marston, #776)
252
+ * Improve `raise_error` matcher so that it can accept a matcher as a single argument
253
+ that matches the message. (Time Wade, #782)
254
+
255
+ Bug Fixes:
256
+
257
+ * Make `contain_exactly` / `match_array` work with strict test doubles
258
+ that have not defined `<=>`. (Myron Marston, #758)
259
+ * Fix `include` matcher so that it omits the diff when it would
260
+ confusingly highlight items that are actually included but are not
261
+ an exact match in a line-by-line diff. (Tim Wade, #763)
262
+ * Fix `match` matcher so that it does not blow up when matching a string
263
+ or regex against another matcher (rather than a string or regex).
264
+ (Myron Marston, #772)
265
+ * Silence whitespace-only diffs. (Myron Marston, #801)
266
+
267
+ ### 3.2.1 / 2015-04-06
268
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.2.0...v3.2.1)
269
+
270
+ Bug Fixes:
271
+
272
+ * Prevent `Range`s from being enumerated when generating matcher
273
+ descriptions. (Jon Rowe, #755)
274
+ * Ensure exception messages are compared as strings in the `raise_error`
275
+ matcher. (Jon Rowe, #755)
276
+
277
+ ### 3.2.0 / 2015-02-03
278
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.1.2...v3.2.0)
279
+
280
+ Enhancements:
281
+
282
+ * Add `block_arg` method to custom matcher API, which allows you to
283
+ access the block passed to a custom matcher, if there is one.
284
+ (Mike Dalton, #645)
285
+ * Provide more detail in failure message of `yield_control` matcher.
286
+ (Jon Rowe, #650)
287
+ * Add a shorthand syntax for `chain` in the matcher DSL which assigns values
288
+ for use elsewhere, for example `chain :and_smaller_than, :small_value`
289
+ creates an `attr_reader` for `small_value` (Tom Stuart, #644)
290
+ * Provide a more helpful deprecation message when using the `should` syntax.
291
+ (Elia Schito, #663)
292
+ * Provide more detail in the `have_attributes` matcher failure message.
293
+ (Jon Rowe, #668)
294
+ * Make the `have_attributes` matcher diffable.
295
+ (Jon Rowe, Alexey Fedorov, #668)
296
+ * Add `output(...).to_std(out|err)_from_any_process` as alternatives
297
+ to `output(...).to_std(out|err)`. The latter doesn't work when a sub
298
+ process writes to the named stream but is much faster.
299
+ (Alex Genco, #700)
300
+ * Improve compound matchers (created by `and` and `or`) so that diffs
301
+ are included in failures when one or more of their matchers
302
+ are diffable. (Alexey Fedorov, #713)
303
+
304
+ Bug Fixes:
305
+
306
+ * Avoid calling `private_methods` from the `be` predicate matcher on
307
+ the target object if the object publicly responds to the predicate
308
+ method. This avoids a possible error that can occur if the object
309
+ raises errors from `private_methods` (which can happen with celluloid
310
+ objects). (@chapmajs, #670)
311
+ * Make `yield_control` (with no modifier) default to
312
+ `at_least(:once)` rather than raising a confusing error
313
+ when multiple yields are encountered.
314
+ (Myron Marston, #675)
315
+ * Fix "instance variable @color not initialized" warning when using
316
+ rspec-expectations outside of an rspec-core context. (Myron Marston, #689)
317
+ * Fix `start_with` and `end_with` to work properly when checking a
318
+ string against an array of strings. (Myron Marston, #690)
319
+ * Don't use internally delegated matchers when generating descriptions
320
+ for examples without doc strings. (Myron Marston, #692)
321
+
322
+ ### 3.1.2 / 2014-09-26
323
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.1.1...v3.1.2)
324
+
325
+ Bug Fixes:
326
+
327
+ * Fix `define_negated_matcher` so that matchers that support fluent
328
+ interfaces continue to be negated after you use the chained method.
329
+ (Myron Marston, #656)
330
+ * Fix `define_negated_matcher` so that the matchers fail with an
331
+ appropriate failure message. (Myron Marston, #659)
332
+
333
+ ### 3.1.1 / 2014-09-15
334
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.1.0...v3.1.1)
335
+
336
+ Bug Fixes:
337
+
338
+ * Fix regression in `all` matcher in 3.1.0 that prevented it from
339
+ working on objects that are not `Enumerable` but do implement
340
+ `each_with_index` (such as an ActiveRecord proxy). (Jori Hardman, #647)
341
+
342
+ ### 3.1.0 / 2014-09-04
343
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.4...v3.1.0)
344
+
345
+ Enhancements:
346
+
347
+ * Add `have_attributes` matcher, that passes if actual's attribute
348
+ values match the expected attributes hash:
349
+ `Person = Struct.new(:name, :age)`
350
+ `person = Person.new("Bob", 32)`
351
+ `expect(person).to have_attributes(:name => "Bob", :age => 32)`.
352
+ (Adam Farhi, #571)
353
+ * Extended compound matcher support to block matchers, for cases like:
354
+ `expect { ... }.to change { x }.to(3).and change { y }.to(4)`. (Myron
355
+ Marston, #567)
356
+ * Include chained methods in custom matcher description and failure message
357
+ when new `include_chain_clauses_in_custom_matcher_descriptions` config
358
+ option is enabled. (Dan Oved, #600)
359
+ * Add `thrice` modifier to `yield_control` matcher as a synonym for
360
+ `exactly(3).times`. (Dennis Taylor, #615)
361
+ * Add `RSpec::Matchers.define_negated_matcher`, which defines a negated
362
+ version of the named matcher. (Adam Farhi, Myron Marston, #618)
363
+ * Document and support negation of `contain_exactly`/`match_array`.
364
+ (Jon Rowe, #626).
365
+
366
+ Bug Fixes:
367
+
368
+ * Rename private `LegacyMacherAdapter` constant to `LegacyMatcherAdapter`
369
+ to fix typo. (Abdelkader Boudih, #563)
370
+ * Fix `all` matcher so that it fails properly (rather than raising a
371
+ `NoMethodError`) when matched against a non-enumerable. (Hao Su, #622)
372
+
373
+ ### 3.0.4 / 2014-08-14
374
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.3...v3.0.4)
375
+
376
+ Bug Fixes:
377
+
378
+ * Fix `start_with` and `end_with` so that they work properly with
379
+ structs. (Myron Marston, #620)
380
+ * Fix failure message generation so that structs are printed properly
381
+ in failures. Previously failure messages would represent them as
382
+ an array. (Myron Marston, #620)
383
+ * Fix composable matcher support so that it does not wrongly treat
384
+ structs as arrays. (Myron Marston, #620)
385
+
386
+ ### 3.0.3 / 2014-07-21
387
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.2...v3.0.3)
388
+
389
+ Bug Fixes:
390
+
391
+ * Fix issue with detection of generic operator matchers so they work
392
+ correctly when undefined. (Myron Marston, #597)
393
+ * Don't inadvertently define `BasicObject` in 1.8.7. (Chris Griego, #603)
394
+ * Fix `include` matcher so that it fails gracefully when matched against
395
+ an object that does not respond to `include?`. (Myron Marston, #607)
396
+
397
+ ### 3.0.2 / 2014-06-19
398
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.1...v3.0.2)
399
+
400
+ Bug Fixes:
401
+
402
+ * Fix regression in `contain_exactly` (AKA `match_array`) that caused it
403
+ to wrongly pass when the expected array was empty. (Myron Marston, #581)
404
+ * Provide a better error message when you use the `change(obj, :msg)`
405
+ form of the change matcher but forget the message argument. (Alex
406
+ Sunderland, #585)
407
+ * Make the `contain_exactly` matcher work with arrays that contain hashes in
408
+ arbitrary ordering. (Sam Phippen, #578)
409
+
410
+ ### 3.0.1 / 2014-06-12
411
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.0...v3.0.1)
412
+
413
+ Bug Fixes:
414
+
415
+ * Add a missing `require` that would cause the `respond_to` matcher to
416
+ fail when used in a project where the rest of RSpec (e.g. core and
417
+ expecatations) weren't being used. (Myron Marston, #566)
418
+ * Structs are no longer treated as arrays when diffed. (Jon Rowe, #576)
419
+
420
+ ### 3.0.0 / 2014-06-01
421
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.0.rc1...v3.0.0)
422
+
423
+ No code changes. Just taking it out of pre-release.
424
+
425
+ ### 3.0.0.rc1 / 2014-05-18
426
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.0.beta2...v3.0.0.rc1)
427
+
428
+ Breaking Changes for 3.0.0:
429
+
430
+ * Remove `matcher_execution_context` attribute from DSL-defined
431
+ custom matchers. (Myron Marston)
432
+ * Remove `RSpec::Matchers::Pretty#_pretty_print`. (Myron Marston)
433
+ * Remove `RSpec::Matchers::Pretty#expected_to_sentence`. (Myron Marston)
434
+ * Rename `RSpec::Matchers::Configuration` constant to
435
+ `RSpec::Expectations::Configuration`. (Myron Marston)
436
+ * Prevent `have_xyz` predicate matchers using private methods.
437
+ (Adrian Gonzalez)
438
+ * Block matchers must now implement `supports_block_expectations?`.
439
+ (Myron Marston)
440
+ * Stop supporting `require 'rspec-expectations'`.
441
+ Use `require 'rspec/expectations'` instead. (Myron Marston)
442
+
443
+ Bug Fixes:
444
+
445
+ * Fix `NoMethodError` triggered by beta2 when `YARD` was loaded in
446
+ the test environment. (Myron Marston)
447
+ * Fix `be_xyz` matcher to accept a `do...end` block. (Myron Marston)
448
+ * Fix composable matcher failure message generation logic
449
+ so that it does not blow up when given `$stdout` or `$stderr`.
450
+ (Myron Marston)
451
+ * Fix `change` matcher to work properly with `IO` objects.
452
+ (Myron Marston)
453
+ * Fix `exist` matcher so that it can be used in composed matcher
454
+ expressions involving objects that do not implement `exist?` or
455
+ `exists?`. (Daniel Fone)
456
+ * Fix composable matcher match logic so that it clones matchers
457
+ before using them in order to work properly with matchers
458
+ that use internal memoization based on a given `actual` value.
459
+ (Myron Marston)
460
+ * Fix `be_xyz` and `has_xyz` predicate matchers so that they can
461
+ be used in composed matcher expressions involving objects that
462
+ do not implement the predicate method. (Daniel Fone)
463
+
464
+ Enhancements:
465
+
466
+ * Document the remaining public APIs. rspec-expectations now has 100% of
467
+ the public API documented and will remain that way (as new undocumented
468
+ methods will fail the build). (Myron Marston)
469
+ * Improve the formatting of BigDecimal objects in `eq` matcher failure
470
+ messages. (Daniel Fone)
471
+ * Improve the failure message for `be_xyz` predicate matchers so
472
+ that it includes the `inspect` output of the receiver.
473
+ (Erik Michaels-Ober, Sam Phippen)
474
+ * Add `all` matcher, to allow you to specify that a given matcher
475
+ matches all elements in a collection:
476
+ `expect([1, 3, 5]).to all( be_odd )`. (Adam Farhi)
477
+ * Add boolean aliases (`&`/`|`) for compound operators (`and`/`or`). (Adam Farhi)
478
+ * Give users a clear error when they wrongly use a value matcher
479
+ in a block expectation expression (e.g. `expect { 3 }.to eq(3)`)
480
+ or vice versa. (Myron Marston)
481
+
482
+ ### 3.0.0.beta2 / 2014-02-17
483
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.0.beta1...v3.0.0.beta2)
484
+
485
+ Breaking Changes for 3.0.0:
486
+
487
+ * Remove deprecated support for accessing the `RSpec` constant using
488
+ `Rspec` or `Spec`. (Myron Marston)
489
+ * Remove deprecated `RSpec::Expectations.differ=`. (Myron Marston)
490
+ * Remove support for deprecated `expect(...).should`. (Myron Marston)
491
+ * Explicitly disallow `expect { }.not_to change { }` with `by`,
492
+ `by_at_least`, `by_at_most` or `to`. These have never been supported
493
+ but did not raise explicit errors. (Myron Marston)
494
+ * Provide `===` rather than `==` as an alias of `matches?` for
495
+ all matchers. The semantics of `===` are closer to an RSpec
496
+ matcher than `==`. (Myron Marston)
497
+ * Remove deprecated `RSpec::Matchers::OperatorMatcher` constant.
498
+ (Myron Marston)
499
+ * Make `RSpec::Expectations::ExpectationNotMetError` subclass
500
+ `Exception` rather than `StandardError` so they can bypass
501
+ a bare `rescue` in end-user code (e.g. when an expectation is
502
+ set from within a rspec-mocks stub implementation). (Myron Marston)
503
+ * Remove Test::Unit and Minitest 4.x integration. (Myron Marston)
504
+
505
+ Enhancements:
506
+
507
+ * Simplify the failure message of the `be` matcher when matching against:
508
+ `true`, `false` and `nil`. (Sam Phippen)
509
+ * Update matcher protocol and custom matcher DSL to better align
510
+ with the newer `expect` syntax. If you want your matchers to
511
+ maintain compatibility with multiple versions of RSpec, you can
512
+ alias the new names to the old. (Myron Marston)
513
+ * `failure_message_for_should` => `failure_message`
514
+ * `failure_message_for_should_not` => `failure_message_when_negated`
515
+ * `match_for_should` => `match`
516
+ * `match_for_should_not` => `match_when_negated`
517
+ * Improve generated descriptions from `change` matcher. (Myron Marston)
518
+ * Add support for compound matcher expressions using `and` and `or`.
519
+ Simply chain them off of any existing matcher to create an expression
520
+ like `expect(alphabet).to start_with("a").and end_with("z")`.
521
+ (Eloy Espinaco)
522
+ * Add `contain_exactly` as a less ambiguous version of `match_array`.
523
+ Note that it expects the expected array to be splatted as
524
+ individual args: `expect(array).to contain_exactly(1, 2)` is
525
+ the same as `expect(array).to match_array([1, 2])`. (Myron Marston)
526
+ * Update `contain_exactly`/`match_array` so that it can match against
527
+ other non-array collections (such as a `Set`). (Myron Marston)
528
+ * Update built-in matchers so that they can accept matchers as arguments
529
+ to allow you to compose matchers in arbitrary ways. (Myron Marston)
530
+ * Add `RSpec::Matchers::Composable` mixin that can be used to make
531
+ a custom matcher composable as well. Note that custom matchers
532
+ defined via `RSpec::Matchers.define` already have this. (Myron
533
+ Marston)
534
+ * Define noun-phrase aliases for built-in matchers, which can be
535
+ used when creating composed matcher expressions that read better
536
+ and provide better failure messages. (Myron Marston)
537
+ * Add `RSpec::Matchers.alias_matcher` so users can define their own
538
+ matcher aliases. The `description` of the matcher will reflect the
539
+ alternate matcher name. (Myron Marston)
540
+ * Add explicit `be_between` matcher. `be_between` has worked for a
541
+ long time as a dynamic predicate matcher, but the failure message
542
+ was suboptimal. The new matcher provides a much better failure
543
+ message. (Erik Michaels-Ober)
544
+ * Enhance the `be_between` matcher to allow for `inclusive` or `exclusive`
545
+ comparison (e.g. inclusive of min/max or exclusive of min/max).
546
+ (Pedro Gimenez)
547
+ * Make failure message for `not_to be #{operator}` less confusing by
548
+ only saying it's confusing when comparison operators are used.
549
+ (Prathamesh Sonpatki)
550
+ * Improve failure message of `eq` matcher when `Time` or `DateTime`
551
+ objects are used so that the full sub-second precision is included.
552
+ (Thomas Holmes, Jeff Wallace)
553
+ * Add `output` matcher for expecting that a block outputs `to_stdout`
554
+ or `to_stderr`. (Luca Pette, Matthias Günther)
555
+ * Forward a provided block on to the `has_xyz?` method call when
556
+ the `have_xyz` matcher is used. (Damian Galarza)
557
+ * Provide integration with Minitest 5.x. Require
558
+ `rspec/expectations/minitest_integration` after loading minitest
559
+ to use rspec-expectations with minitest. (Myron Marston)
560
+
561
+ Bug Fixes:
562
+
563
+ * Fix wrong matcher descriptions with falsey expected value (yujinakayama)
564
+ * Fix `expect { }.not_to change { }.from(x)` so that the matcher only
565
+ passes if the starting value is `x`. (Tyler Rick, Myron Marston)
566
+ * Fix hash diffing, so that it colorizes properly and doesn't consider trailing
567
+ commas when performing the diff. (Jared Norman)
568
+ * Fix built-in matchers to fail normally rather than raising
569
+ `ArgumentError` when given an object of the wrong type to match
570
+ against, so that they work well in composite matcher expressions like
571
+ `expect([1.51, "foo"]).to include(a_string_matching(/foo/), a_value_within(0.1).of(1.5))`.
572
+ (Myron Marston)
573
+
574
+ Deprecations:
575
+
576
+ * Retain support for RSpec 2 matcher protocol (e.g. for matchers
577
+ in 3rd party extension gems like `shoulda`), but it will print
578
+ a deprecation warning. (Myron Marston)
579
+
580
+ ### 3.0.0.beta1 / 2013-11-07
581
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.99.2...v3.0.0.beta1)
582
+
583
+ Breaking Changes for 3.0.0:
584
+
585
+ * Remove explicit support for 1.8.6. (Jon Rowe)
586
+ * Remove the deprecated `be_close` matcher, preferring `be_within` instead.
587
+ (Sam Phippen)
588
+ * Remove the deprecated `have`, `have_at_least` and `have_at_most` matchers.
589
+ You can continue using those matchers through https://github.com/rspec/rspec-collection_matchers,
590
+ or you can rewrite your expectations with something like
591
+ `expect(your_object.size).to eq(num)`. (Hugo Baraúna)
592
+ * Rename `be_true` and `be_false` to `be_truthy` and `be_falsey`. (Sam Phippen)
593
+ * Make `expect { }.to_not raise_error(SomeSpecificClass, message)`,
594
+ `expect { }.to_not raise_error(SomeSpecificClass)` and
595
+ `expect { }.to_not raise_error(message)` invalid, since they are prone
596
+ to hiding failures. Instead, use `expect { }.to_not raise_error` (with no
597
+ args). (Sam Phippen)
598
+ * Within `RSpec::Matchers.define` blocks, helper methods made available
599
+ either via `def self.helper` or `extend HelperModule` are no longer
600
+ available to the `match` block (or any of the others). Instead
601
+ `include` your helper module and define the helper method as an
602
+ instance method. (Myron Marston)
603
+ * Force upgrading Diff::LCS for encoding compatability with diffs. (Jon Rowe)
604
+
605
+ Enhancements:
606
+
607
+ * Support `do..end` style block with `raise_error` matcher. (Yuji Nakayama)
608
+ * Rewrote custom matcher DSL to simplify its implementation and solve a
609
+ few issues. (Myron Marston)
610
+ * Allow early `return` from within custom matcher DSL blocks. (Myron
611
+ Marston)
612
+ * The custom matcher DSL's `chain` can now accept a block. (Myron
613
+ Marston)
614
+ * Support setting an expectation on a `raise_error` matcher via a chained
615
+ `with_message` method call. (Sam Phippen)
616
+
617
+ Bug Fixes:
618
+
619
+ * Allow `include` and `match` matchers to be used from within a
620
+ DSL-defined custom matcher's `match` block. (Myron Marston)
621
+ * Correct encoding error message on diff failure (Jon Rowe)
622
+
623
+ Deprecations:
624
+
625
+ * Using the old `:should` syntax without explicitly configuring it is deprecated.
626
+ It will continue to work but will emit a deprecation warning in RSpec 3 if
627
+ you do not explicitly enable it. (Sam Phippen)
628
+
629
+ ### 2.99.2 / 2014-07-21
630
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.99.1...v2.99.2)
631
+
632
+ Bug Fixes:
633
+
634
+ * Fix regression in `Expectations#method_handle_for` where proxy objects
635
+ with method delegated would wrongly not return a method handle.
636
+ (Jon Rowe, #594)
637
+ * Fix issue with detection of generic operator matchers so they work
638
+ correctly when undefined. (Myron Marston, #597)
639
+
640
+ ### 2.99.1 / 2014-06-19
641
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.99.0...v2.99.1)
642
+
643
+ Bug Fixes:
644
+
645
+ * Fix typo in custom matcher `expected` deprecation warning -- it's
646
+ `expected_as_array`, not `expected_array`. (Frederick Cheung, #562)
647
+
648
+ ### 2.99.0 / 2014-06-01
649
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.99.0.rc1...v2.99.0)
650
+
651
+ Enhancements:
652
+
653
+ * Special case deprecation message for `errors_on` with `rspec-rails` to be more useful.
654
+ (Aaron Kromer)
655
+
656
+ ### 2.99.0.rc1 / 2014-05-18
657
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.99.0.beta2...2.99.0.rc1)
658
+
659
+ Deprecations:
660
+
661
+ * Deprecate `matcher_execution_context` attribute on DSL-defined
662
+ custom matchers. (Myron Marston)
663
+ * Deprecate `RSpec::Matchers::Pretty#_pretty_print`. (Myron Marston)
664
+ * Deprecate `RSpec::Matchers::Pretty#expected_to_sentence`. (Myron Marston)
665
+ * Deprecate `RSpec::Matchers::Configuration` in favor of
666
+ `RSpec::Expectations::Configuration`. (Myron Marston)
667
+ * Deprecate `be_xyz` predicate matcher on an object that doesn't respond to
668
+ `xyz?` or `xyzs?`. (Daniel Fone)
669
+ * Deprecate `have_xyz` matcher on an object that doesn't respond to `has_xyz?`.
670
+ (Daniel Fone)
671
+ * Deprecate `have_xyz` matcher on an object that has a private method `has_xyz?`.
672
+ (Jon Rowe)
673
+ * Issue a deprecation warning when a block expectation expression is
674
+ used with a matcher that doesn't explicitly support block expectations
675
+ via `supports_block_expectations?`. (Myron Marston)
676
+ * Deprecate `require 'rspec-expectations'`. Use
677
+ `require 'rspec/expectations'` instead. (Myron Marston)
678
+
679
+ ### 2.99.0.beta2 / 2014-02-17
680
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.99.0.beta1...v2.99.0.beta2)
681
+
682
+ Deprecations:
683
+
684
+ * Deprecate chaining `by`, `by_at_least`, `by_at_most` or `to` off of
685
+ `expect { }.not_to change { }`. The docs have always said these are
686
+ not supported for the negative form but now they explicitly raise
687
+ errors in RSpec 3. (Myron Marston)
688
+ * Change the semantics of `expect { }.not_to change { x }.from(y)`.
689
+ In RSpec 2.x, this expectation would only fail if `x` started with
690
+ the value of `y` and changed. If it started with a different value
691
+ and changed, it would pass. In RSpec 3, it will pass only if the
692
+ value starts at `y` and it does not change. (Myron Marston)
693
+ * Deprecate `matcher == value` as an alias for `matcher.matches?(value)`,
694
+ in favor of `matcher === value`. (Myron Marston)
695
+ * Deprecate `RSpec::Matchers::OperatorMatcher` in favor of
696
+ `RSpec::Matchers::BuiltIn::OperatorMatcher`. (Myron Marston)
697
+ * Deprecate auto-integration with Test::Unit and minitest.
698
+ Instead, include `RSpec::Matchers` in the appropriate test case
699
+ base class yourself. (Myron Marston)
700
+ * Deprecate treating `#expected` on a DSL-generated custom matcher
701
+ as an array when only 1 argument is passed to the matcher method.
702
+ In RSpec 3 it will be the single value in order to make diffs
703
+ work properly. (Jon Rowe)
704
+
705
+ ### 2.99.0.beta1 / 2013-11-07
706
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.4...v2.99.0.beta1)
707
+
708
+ Deprecations
709
+
710
+ * Deprecate `have`, `have_at_least` and `have_at_most`. You can continue using those
711
+ matchers through https://github.com/rspec/rspec-collection_matchers, or
712
+ you can rewrite your expectations with something like
713
+ `expect(your_object.size).to eq(num)`. (Hugo Baraúna)
714
+ * Deprecate `be_xyz` predicate matcher when `xyz?` is a private method.
715
+ (Jon Rowe)
716
+ * Deprecate `be_true`/`be_false` in favour of `be_truthy`/`be_falsey`
717
+ (for Ruby's conditional semantics) or `be true`/`be false`
718
+ (for exact equality). (Sam Phippen)
719
+ * Deprecate calling helper methods from a custom matcher with the wrong
720
+ scope. (Myron Marston)
721
+ * `def self.foo` / `extend Helper` can be used to add macro methods
722
+ (e.g. methods that call the custom matcher DSL methods), but should
723
+ not be used to define helper methods called from within the DSL
724
+ blocks.
725
+ * `def foo` / `include Helper` is the opposite: it's for helper methods
726
+ callable from within a DSL block, but not for defining macros.
727
+ * RSpec 2.x allowed helper methods defined either way to be used for
728
+ either purpose, but RSpec 3.0 will not.
729
+
730
+ ### 2.14.5 / 2014-02-01
731
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.4...v2.14.5)
732
+
733
+ Bug fixes
734
+
735
+ * Fix wrong matcher descriptions with falsey expected value
736
+ (yujinakayama)
737
+
738
+ ### 2.14.4 / 2013-11-06
739
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.3...v2.14.4)
740
+
741
+ Bug fixes
742
+
743
+ * Make the `match` matcher produce a diff output. (Jon Rowe, Ben Moss)
744
+ * Choose encoding for diff's more intelligently, and when all else fails fall
745
+ back to default internal encoding with replacing characters. (Jon Rowe)
746
+
747
+ ### 2.14.3 / 2013-09-22
748
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.2...v2.14.3)
749
+
750
+ Bug fixes
751
+
752
+ * Fix operator matchers (`should` syntax) when `method` is redefined on target.
753
+ (Brandon Turner)
754
+ * Fix diffing of hashes with object based keys. (Jon Rowe)
755
+ * Fix operator matchers (`should` syntax) when operator is defined via
756
+ `method_missing` (Jon Rowe)
757
+
758
+ ### 2.14.2 / 2013-08-14
759
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.1...v2.14.2)
760
+
761
+ Bug fixes
762
+
763
+ * Fix `be_<predicate>` matcher to not support operator chaining like the
764
+ `be` matcher does (e.g. `be == 5`). This led to some odd behaviors
765
+ since `be_<predicate> == anything` returned a `BeComparedTo` matcher
766
+ and was thus always truthy. This was a consequence of the implementation
767
+ (e.g. subclassing the basic `Be` matcher) and was not intended behavior.
768
+ (Myron Marston).
769
+ * Fix `change` matcher to compare using `==` in addition to `===`. This
770
+ is important for an expression like:
771
+ `expect {}.to change { a.class }.from(ClassA).to(ClassB)` because
772
+ `SomeClass === SomeClass` returns false. (Myron Marston)
773
+
774
+ ### 2.14.1 / 2013-08-08
775
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.0...2.14.1)
776
+
777
+ Bug fixes
778
+
779
+ * Ensure diff output uses the same encoding as the encoding of
780
+ the string being diff'd to prevent `Encoding::UndefinedConversionError`
781
+ errors (Jon Rowe).
782
+
783
+ ### 2.14.0 / 2013-07-06
784
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.0.rc1...v2.14.0)
785
+
786
+ Bug fixes
787
+
788
+ * Values that are not matchers use `#inspect`, rather than `#description` for
789
+ documentation output (Andy Lindeman, Sam Phippen).
790
+ * Make `expect(a).to be_within(x).percent_of(y)` work with negative y
791
+ (Katsuhiko Nishimra).
792
+ * Make the `be_predicate` matcher work as expected used with `expect{...}.to
793
+ change...` (Sam Phippen).
794
+
795
+ ### 2.14.0.rc1 / 2013-05-27
796
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.13.0...v2.14.0.rc1)
797
+
798
+ Enhancements
799
+
800
+ * Enhance `yield_control` so that you can specify an exact or relative
801
+ number of times: `expect { }.to yield_control.exactly(3).times`,
802
+ `expect { }.to yield_control.at_least(2).times`, etc (Bartek
803
+ Borkowski).
804
+ * Make the differ that is used when an expectation fails better handle arrays
805
+ by splitting each element of the array onto its own line. (Sam Phippen)
806
+ * Accept duck-typed strings that respond to `:to_str` as expectation messages.
807
+ (Toby Ovod-Everett)
808
+
809
+ Bug fixes
810
+
811
+ * Fix differ to not raise errors when dealing with differently-encoded
812
+ strings (Jon Rowe).
813
+ * Fix `expect(something).to be_within(x).percent_of(y)` where x and y are both
814
+ integers (Sam Phippen).
815
+ * Fix `have` matcher to handle the fact that on ruby 2.0,
816
+ `Enumerator#size` may return nil (Kenta Murata).
817
+ * Fix `expect { raise s }.to raise_error(s)` where s is an error instance
818
+ on ruby 2.0 (Sam Phippen).
819
+ * Fix `expect(object).to raise_error` passing. This now warns the user and
820
+ fails the spec (tomykaira).
821
+
822
+ Deprecations
823
+
824
+ * Deprecate `expect { }.not_to raise_error(SpecificErrorClass)` or
825
+ `expect { }.not_to raise_error("some specific message")`. Using
826
+ these was prone to hiding failures as they would allow _any other
827
+ error_ to pass. (Sam Phippen and David Chelimsky)
828
+
829
+ ### 2.13.0 / 2013-02-23
830
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.12.1...v2.13.0)
831
+
832
+ Enhancements
833
+
834
+ * Add support for percent deltas to `be_within` matcher:
835
+ `expect(value).to be_within(10).percent_of(expected)`
836
+ (Myron Marston).
837
+ * Add support to `include` matcher to allow it to be given a list
838
+ of matchers as the expecteds to match against (Luke Redpath).
839
+
840
+ Bug fixes
841
+
842
+ * Fix `change` matcher so that it dups strings in order to handle
843
+ mutated strings (Myron Marston).
844
+ * Fix `should be =~ /some regex/` / `expect(...).to be =~ /some regex/`.
845
+ Previously, these either failed with a confusing `undefined method
846
+ matches?' for false:FalseClass` error or were no-ops that didn't
847
+ actually verify anything (Myron Marston).
848
+ * Add compatibility for diff-lcs 1.2 and relax the version
849
+ constraint (Peter Goldstein).
850
+ * Fix DSL-generated matchers to allow multiple instances of the
851
+ same matcher in the same example to have different description
852
+ and failure messages based on the expected value (Myron Marston).
853
+ * Prevent `undefined method #split for Array` error when dumping
854
+ the diff of an array of multiline strings (Myron Marston).
855
+ * Don't blow up when comparing strings that are in an encoding
856
+ that is not ASCII compatible (Myron Marston).
857
+ * Remove confusing "Check the implementation of #==" message
858
+ printed for empty diffs (Myron Marston).
859
+
860
+ ### 2.12.1 / 2012-12-15
861
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.12.0...v2.12.1)
862
+
863
+ Bug fixes
864
+
865
+ * Improve the failure message for an expression like
866
+ `{}.should =~ {}`. (Myron Marston and Andy Lindeman)
867
+ * Provide a `match_regex` alias so that custom matchers
868
+ built using the matcher DSL can use it (since `match`
869
+ is a different method in that context).
870
+ (Steven Harman)
871
+
872
+ ### 2.12.0 / 2012-11-12
873
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.3...v2.12.0)
874
+
875
+ Enhancements
876
+
877
+ * Colorize diffs if the `--color` option is configured. (Alex Coplan)
878
+ * Include backtraces in unexpected errors handled by `raise_error`
879
+ matcher (Myron Marston)
880
+ * Print a warning when users accidentally pass a non-string argument
881
+ as an expectation message (Sam Phippen)
882
+ * `=~` and `match_array` matchers output a more useful error message when
883
+ the actual value is not an array (or an object that responds to `#to_ary`)
884
+ (Sam Phippen)
885
+
886
+ Bug fixes
887
+
888
+ * Fix `include` matcher so that `expect({}).to include(:a => nil)`
889
+ fails as it should (Sam Phippen).
890
+ * Fix `be_an_instance_of` matcher so that `Class#to_s` is used in the
891
+ description rather than `Class#inspect`, since some classes (like
892
+ `ActiveRecord::Base`) define a long, verbose `#inspect`.
893
+ (Tom Stuart)
894
+
895
+ ### 2.11.3 / 2012-09-04
896
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.2...v2.11.3)
897
+
898
+ Bug fixes
899
+
900
+ * Fix (and deprecate) `expect { }.should` syntax so that it works even
901
+ though it was never a documented or intended syntax. It worked as a
902
+ consequence of the implementation of `expect` in RSpec 2.10 and
903
+ earlier. (Myron Marston)
904
+ * Ensure #== is defined on built in matchers so that they can be composed.
905
+ For example:
906
+
907
+ expect {
908
+ user.emailed!
909
+ }.to change { user.last_emailed_at }.to be_within(1.second).of(Time.zone.now)
910
+
911
+ ### 2.11.2 / 2012-07-25
912
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.1...v2.11.2)
913
+
914
+ Bug fixes
915
+
916
+ * Define `should` and `should_not` on `Object` rather than `BasicObject`
917
+ on MacRuby. On MacRuby, `BasicObject` is defined but is not the root
918
+ of the object hierarchy. (Gabriel Gilder)
919
+
920
+ ### 2.11.1 / 2012-07-08
921
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.0...v2.11.1)
922
+
923
+ Bug fixes
924
+
925
+ * Constrain `actual` in `be_within` matcher to values that respond to `-` instead
926
+ of requiring a specific type.
927
+ * `Time`, for example, is a legit alternative.
928
+
929
+ ### 2.11.0 / 2012-07-07
930
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.10.0...v2.11.0)
931
+
932
+ Enhancements
933
+
934
+ * Expand `expect` syntax so that it supports expections on bare values
935
+ in addition to blocks (Myron Marston).
936
+ * Add configuration options to control available expectation syntaxes
937
+ (Myron Marston):
938
+ * `RSpec.configuration.expect_with(:rspec) { |c| c.syntax = :expect }`
939
+ * `RSpec.configuration.expect_with(:rspec) { |c| c.syntax = :should }`
940
+ * `RSpec.configuration.expect_with(:rspec) { |c| c.syntax = [:should, :expect] }`
941
+ * `RSpec.configuration.add_should_and_should_not_to Delegator`
942
+
943
+ Bug fixes
944
+
945
+ * Allow only `Numeric` values to be the "actual" in the `be_within` matcher.
946
+ This prevents confusing error messages. (Su Zhang @zhangsu)
947
+ * Define `should` and `should_not` on `BasicObject` rather than `Kernel`
948
+ on 1.9. This makes `should` and `should_not` work properly with
949
+ `BasicObject`-subclassed proxy objects like `Delegator`. (Myron
950
+ Marston)
951
+
952
+ ### 2.10.0 / 2012-05-03
953
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.9.1...v2.10.0)
954
+
955
+ Enhancements
956
+
957
+ * Add new `start_with` and `end_with` matchers (Jeremy Wadsack)
958
+ * Add new matchers for specifying yields (Myron Marston):
959
+ * `expect {...}.to yield_control`
960
+ * `expect {...}.to yield_with_args(1, 2, 3)`
961
+ * `expect {...}.to yield_with_no_args`
962
+ * `expect {...}.to yield_successive_args(1, 2, 3)`
963
+ * `match_unless_raises` takes multiple exception args
964
+
965
+ Bug fixes
966
+
967
+ * Fix `be_within` matcher to be inclusive of delta.
968
+ * Fix message-specific specs to pass on Rubinius (John Firebaugh)
969
+
970
+ ### 2.9.1 / 2012-04-03
971
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.9.0...v2.9.1)
972
+
973
+ Bug fixes
974
+
975
+ * Provide a helpful message if the diff between two objects is empty.
976
+ * Fix bug diffing single strings with multiline strings.
977
+ * Fix for error with using custom matchers inside other custom matchers
978
+ (mirasrael)
979
+ * Fix using execution context methods in nested DSL matchers (mirasrael)
980
+
981
+ ### 2.9.0 / 2012-03-17
982
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0...v2.9.0)
983
+
984
+ Enhancements
985
+
986
+ * Move built-in matcher classes to RSpec::Matchers::BuiltIn to reduce pollution
987
+ of RSpec::Matchers (which is included in every example).
988
+ * Autoload files with matcher classes to improve load time.
989
+
990
+ Bug fixes
991
+
992
+ * Align `respond_to?` and `method_missing` in DSL-defined matchers.
993
+ * Clear out user-defined instance variables between invocations of DSL-defined
994
+ matchers.
995
+ * Dup the instance of a DSL generated matcher so its state is not changed by
996
+ subsequent invocations.
997
+ * Treat expected args consistently across positive and negative expectations
998
+ (thanks to Ralf Kistner for the heads up)
999
+
1000
+ ### 2.8.0 / 2012-01-04
1001
+
1002
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0.rc2...v2.8.0)
1003
+
1004
+ Enhancements
1005
+
1006
+ * Better diff output for Hash (Philippe Creux)
1007
+ * Eliminate Ruby warnings (Olek Janiszewski)
1008
+
1009
+ ### 2.8.0.rc2 / 2011-12-19
1010
+
1011
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0.rc1...v2.8.0.rc2)
1012
+
1013
+ No changes for this release. Just releasing with the other rspec gems.
1014
+
1015
+ ### 2.8.0.rc1 / 2011-11-06
1016
+
1017
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.7.0...v2.8.0.rc1)
1018
+
1019
+ Enhancements
1020
+
1021
+ * Use classes for the built-in matchers (they're faster).
1022
+ * Eliminate Ruby warnings (Matijs van Zuijlen)
1023
+
1024
+ ### 2.7.0 / 2011-10-16
1025
+
1026
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.6.0...v2.7.0)
1027
+
1028
+ Enhancements
1029
+
1030
+ * `HaveMatcher` converts argument using `to_i` (Alex Bepple & Pat Maddox)
1031
+ * Improved failure message for the `have_xxx` matcher (Myron Marston)
1032
+ * `HaveMatcher` supports `count` (Matthew Bellantoni)
1033
+ * Change matcher dups `Enumerable` before the action, supporting custom
1034
+ `Enumerable` types like `CollectionProxy` in Rails (David Chelimsky)
1035
+
1036
+ Bug fixes
1037
+
1038
+ * Fix typo in `have(n).xyz` documentation (Jean Boussier)
1039
+ * fix `safe_sort` for ruby 1.9.2 (`Kernel` now defines `<=>` for Object) (Peter
1040
+ van Hardenberg)
1041
+
1042
+ ### 2.6.0 / 2011-05-12
1043
+
1044
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.5.0...v2.6.0)
1045
+
1046
+ Enhancements
1047
+
1048
+ * `change` matcher accepts regexps (Robert Davis)
1049
+ * better descriptions for `have_xxx` matchers (Magnus Bergmark)
1050
+ * `range.should cover(*values)` (Anders Furseth)
1051
+
1052
+ Bug fixes
1053
+
1054
+ * Removed non-ascii characters that were choking rcov (Geoffrey Byers)
1055
+ * change matcher dups arrays and hashes so their before/after states can be
1056
+ compared correctly.
1057
+ * Fix the order of inclusion of RSpec::Matchers in Test::Unit::TestCase and
1058
+ MiniTest::Unit::TestCase to prevent a SystemStackError (Myron Marston)
1059
+
1060
+ ### 2.5.0 / 2011-02-05
1061
+
1062
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.4.0...v2.5.0)
1063
+
1064
+ Enhancements
1065
+
1066
+ * `should exist` works with `exist?` or `exists?` (Myron Marston)
1067
+ * `expect { ... }.not_to do_something` (in addition to `to_not`)
1068
+
1069
+ Documentation
1070
+
1071
+ * improved docs for raise_error matcher (James Almond)
1072
+
1073
+ ### 2.4.0 / 2011-01-02
1074
+
1075
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.3.0...v2.4.0)
1076
+
1077
+ No functional changes in this release, which was made to align with the
1078
+ rspec-core-2.4.0 release.
1079
+
1080
+ Enhancements
1081
+
1082
+ * improved RDoc for change matcher (Jo Liss)
1083
+
1084
+ ### 2.3.0 / 2010-12-12
1085
+
1086
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.2.1...v2.3.0)
1087
+
1088
+ Enhancements
1089
+
1090
+ * diff strings when include matcher fails (Mike Sassak)
1091
+
1092
+ ### 2.2.0 / 2010-11-28
1093
+
1094
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.1.0...v2.2.0)
1095
+
1096
+ ### 2.1.0 / 2010-11-07
1097
+
1098
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.1...v2.1.0)
1099
+
1100
+ Enhancements
1101
+
1102
+ * `be_within(delta).of(expected)` matcher (Myron Marston)
1103
+ * Lots of new Cucumber features (Myron Marston)
1104
+ * Raise error if you try `should != expected` on Ruby-1.9 (Myron Marston)
1105
+ * Improved failure messages from `throw_symbol` (Myron Marston)
1106
+
1107
+ Bug fixes
1108
+
1109
+ * Eliminate hard dependency on `RSpec::Core` (Myron Marston)
1110
+ * `have_matcher` - use pluralize only when ActiveSupport inflections are indeed
1111
+ defined (Josep M Bach)
1112
+ * throw_symbol matcher no longer swallows exceptions (Myron Marston)
1113
+ * fix matcher chaining to avoid name collisions (Myron Marston)
1114
+
1115
+ ### 2.0.0 / 2010-10-10
1116
+
1117
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.rc...v2.0.0)
1118
+
1119
+ Enhancements
1120
+
1121
+ * Add match_for_should_not method to matcher DSL (Myron Marston)
1122
+
1123
+ Bug fixes
1124
+
1125
+ * `respond_to` matcher works correctly with `should_not` with multiple methods
1126
+ (Myron Marston)
1127
+ * `include` matcher works correctly with `should_not` with multiple values
1128
+ (Myron Marston)
1129
+
1130
+ ### 2.0.0.rc / 2010-10-05
1131
+
1132
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.beta.22...v2.0.0.rc)
1133
+
1134
+ Enhancements
1135
+
1136
+ * `require 'rspec/expectations'` in a T::U or MiniUnit suite (Josep M. Bach)
1137
+
1138
+ Bug fixes
1139
+
1140
+ * change by 0 passes/fails correctly (Len Smith)
1141
+ * Add description to satisfy matcher
1142
+
1143
+ ### 2.0.0.beta.22 / 2010-09-12
1144
+
1145
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.beta.20...v2.0.0.beta.22)
1146
+
1147
+ Enhancements
1148
+
1149
+ * diffing improvements
1150
+ * diff multiline strings
1151
+ * don't diff single line strings
1152
+ * don't diff numbers (silly)
1153
+ * diff regexp + multiline string
1154
+
1155
+ Bug fixes
1156
+ * `should[_not]` change now handles boolean values correctly