rspec-expectations 2.14.0 → 3.13.0

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 (155) 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 +976 -25
  6. data/{License.txt → LICENSE.md} +5 -3
  7. data/README.md +162 -26
  8. data/lib/rspec/expectations/block_snippet_extractor.rb +253 -0
  9. data/lib/rspec/expectations/configuration.rb +230 -0
  10. data/lib/rspec/expectations/expectation_target.rb +127 -51
  11. data/lib/rspec/expectations/fail_with.rb +17 -57
  12. data/lib/rspec/expectations/failure_aggregator.rb +229 -0
  13. data/lib/rspec/expectations/handler.rb +146 -32
  14. data/lib/rspec/expectations/minitest_integration.rb +58 -0
  15. data/lib/rspec/expectations/syntax.rb +68 -100
  16. data/lib/rspec/expectations/version.rb +1 -1
  17. data/lib/rspec/expectations.rb +58 -23
  18. data/lib/rspec/matchers/aliased_matcher.rb +116 -0
  19. data/lib/rspec/matchers/built_in/all.rb +86 -0
  20. data/lib/rspec/matchers/built_in/base_matcher.rb +191 -20
  21. data/lib/rspec/matchers/built_in/be.rb +114 -114
  22. data/lib/rspec/matchers/built_in/be_between.rb +77 -0
  23. data/lib/rspec/matchers/built_in/be_instance_of.rb +15 -4
  24. data/lib/rspec/matchers/built_in/be_kind_of.rb +10 -1
  25. data/lib/rspec/matchers/built_in/be_within.rb +35 -18
  26. data/lib/rspec/matchers/built_in/change.rb +389 -80
  27. data/lib/rspec/matchers/built_in/compound.rb +290 -0
  28. data/lib/rspec/matchers/built_in/contain_exactly.rb +310 -0
  29. data/lib/rspec/matchers/built_in/count_expectation.rb +169 -0
  30. data/lib/rspec/matchers/built_in/cover.rb +3 -0
  31. data/lib/rspec/matchers/built_in/eq.rb +30 -8
  32. data/lib/rspec/matchers/built_in/eql.rb +23 -8
  33. data/lib/rspec/matchers/built_in/equal.rb +55 -22
  34. data/lib/rspec/matchers/built_in/exist.rb +74 -10
  35. data/lib/rspec/matchers/built_in/has.rb +141 -22
  36. data/lib/rspec/matchers/built_in/have_attributes.rb +114 -0
  37. data/lib/rspec/matchers/built_in/include.rb +184 -32
  38. data/lib/rspec/matchers/built_in/match.rb +95 -1
  39. data/lib/rspec/matchers/built_in/operators.rb +128 -0
  40. data/lib/rspec/matchers/built_in/output.rb +207 -0
  41. data/lib/rspec/matchers/built_in/raise_error.rb +192 -44
  42. data/lib/rspec/matchers/built_in/respond_to.rb +154 -28
  43. data/lib/rspec/matchers/built_in/satisfy.rb +39 -9
  44. data/lib/rspec/matchers/built_in/start_or_end_with.rb +94 -0
  45. data/lib/rspec/matchers/built_in/throw_symbol.rb +58 -14
  46. data/lib/rspec/matchers/built_in/yield.rb +240 -161
  47. data/lib/rspec/matchers/built_in.rb +47 -33
  48. data/lib/rspec/matchers/composable.rb +171 -0
  49. data/lib/rspec/matchers/dsl.rb +531 -10
  50. data/lib/rspec/matchers/english_phrasing.rb +58 -0
  51. data/lib/rspec/matchers/fail_matchers.rb +42 -0
  52. data/lib/rspec/matchers/generated_descriptions.rb +14 -8
  53. data/lib/rspec/matchers/matcher_delegator.rb +61 -0
  54. data/lib/rspec/matchers/matcher_protocol.rb +105 -0
  55. data/lib/rspec/matchers/multi_matcher_diff.rb +82 -0
  56. data/lib/rspec/matchers.rb +520 -173
  57. data.tar.gz.sig +0 -0
  58. metadata +141 -242
  59. metadata.gz.sig +2 -0
  60. data/features/README.md +0 -48
  61. data/features/Upgrade.md +0 -53
  62. data/features/built_in_matchers/README.md +0 -90
  63. data/features/built_in_matchers/be.feature +0 -175
  64. data/features/built_in_matchers/be_within.feature +0 -48
  65. data/features/built_in_matchers/cover.feature +0 -47
  66. data/features/built_in_matchers/end_with.feature +0 -48
  67. data/features/built_in_matchers/equality.feature +0 -139
  68. data/features/built_in_matchers/exist.feature +0 -45
  69. data/features/built_in_matchers/expect_change.feature +0 -59
  70. data/features/built_in_matchers/expect_error.feature +0 -144
  71. data/features/built_in_matchers/have.feature +0 -109
  72. data/features/built_in_matchers/include.feature +0 -174
  73. data/features/built_in_matchers/match.feature +0 -52
  74. data/features/built_in_matchers/operators.feature +0 -227
  75. data/features/built_in_matchers/predicates.feature +0 -137
  76. data/features/built_in_matchers/respond_to.feature +0 -84
  77. data/features/built_in_matchers/satisfy.feature +0 -33
  78. data/features/built_in_matchers/start_with.feature +0 -48
  79. data/features/built_in_matchers/throw_symbol.feature +0 -91
  80. data/features/built_in_matchers/types.feature +0 -116
  81. data/features/built_in_matchers/yield.feature +0 -161
  82. data/features/custom_matchers/access_running_example.feature +0 -53
  83. data/features/custom_matchers/define_diffable_matcher.feature +0 -27
  84. data/features/custom_matchers/define_matcher.feature +0 -368
  85. data/features/custom_matchers/define_matcher_outside_rspec.feature +0 -38
  86. data/features/custom_matchers/define_matcher_with_fluent_interface.feature +0 -24
  87. data/features/customized_message.feature +0 -22
  88. data/features/diffing.feature +0 -85
  89. data/features/implicit_docstrings.feature +0 -52
  90. data/features/step_definitions/additional_cli_steps.rb +0 -22
  91. data/features/support/env.rb +0 -14
  92. data/features/syntax_configuration.feature +0 -71
  93. data/features/test_frameworks/test_unit.feature +0 -44
  94. data/lib/rspec/expectations/deprecation.rb +0 -17
  95. data/lib/rspec/expectations/differ.rb +0 -133
  96. data/lib/rspec/expectations/errors.rb +0 -9
  97. data/lib/rspec/expectations/extensions/array.rb +0 -9
  98. data/lib/rspec/expectations/extensions/object.rb +0 -29
  99. data/lib/rspec/expectations/extensions.rb +0 -2
  100. data/lib/rspec/matchers/be_close.rb +0 -9
  101. data/lib/rspec/matchers/built_in/have.rb +0 -124
  102. data/lib/rspec/matchers/built_in/match_array.rb +0 -51
  103. data/lib/rspec/matchers/built_in/start_and_end_with.rb +0 -48
  104. data/lib/rspec/matchers/compatibility.rb +0 -14
  105. data/lib/rspec/matchers/configuration.rb +0 -108
  106. data/lib/rspec/matchers/extensions/instance_eval_with_args.rb +0 -39
  107. data/lib/rspec/matchers/matcher.rb +0 -300
  108. data/lib/rspec/matchers/method_missing.rb +0 -12
  109. data/lib/rspec/matchers/operator_matcher.rb +0 -109
  110. data/lib/rspec/matchers/pretty.rb +0 -70
  111. data/lib/rspec/matchers/test_unit_integration.rb +0 -11
  112. data/lib/rspec-expectations.rb +0 -1
  113. data/spec/rspec/expectations/differ_spec.rb +0 -192
  114. data/spec/rspec/expectations/expectation_target_spec.rb +0 -82
  115. data/spec/rspec/expectations/extensions/kernel_spec.rb +0 -67
  116. data/spec/rspec/expectations/fail_with_spec.rb +0 -114
  117. data/spec/rspec/expectations/handler_spec.rb +0 -227
  118. data/spec/rspec/expectations/syntax_spec.rb +0 -139
  119. data/spec/rspec/matchers/base_matcher_spec.rb +0 -62
  120. data/spec/rspec/matchers/be_close_spec.rb +0 -22
  121. data/spec/rspec/matchers/be_instance_of_spec.rb +0 -63
  122. data/spec/rspec/matchers/be_kind_of_spec.rb +0 -41
  123. data/spec/rspec/matchers/be_spec.rb +0 -516
  124. data/spec/rspec/matchers/be_within_spec.rb +0 -137
  125. data/spec/rspec/matchers/change_spec.rb +0 -553
  126. data/spec/rspec/matchers/configuration_spec.rb +0 -206
  127. data/spec/rspec/matchers/cover_spec.rb +0 -69
  128. data/spec/rspec/matchers/description_generation_spec.rb +0 -190
  129. data/spec/rspec/matchers/dsl_spec.rb +0 -57
  130. data/spec/rspec/matchers/eq_spec.rb +0 -60
  131. data/spec/rspec/matchers/eql_spec.rb +0 -41
  132. data/spec/rspec/matchers/equal_spec.rb +0 -78
  133. data/spec/rspec/matchers/exist_spec.rb +0 -124
  134. data/spec/rspec/matchers/has_spec.rb +0 -122
  135. data/spec/rspec/matchers/have_spec.rb +0 -455
  136. data/spec/rspec/matchers/include_matcher_integration_spec.rb +0 -30
  137. data/spec/rspec/matchers/include_spec.rb +0 -531
  138. data/spec/rspec/matchers/match_array_spec.rb +0 -194
  139. data/spec/rspec/matchers/match_spec.rb +0 -61
  140. data/spec/rspec/matchers/matcher_spec.rb +0 -471
  141. data/spec/rspec/matchers/matchers_spec.rb +0 -37
  142. data/spec/rspec/matchers/method_missing_spec.rb +0 -28
  143. data/spec/rspec/matchers/operator_matcher_spec.rb +0 -223
  144. data/spec/rspec/matchers/raise_error_spec.rb +0 -485
  145. data/spec/rspec/matchers/respond_to_spec.rb +0 -292
  146. data/spec/rspec/matchers/satisfy_spec.rb +0 -44
  147. data/spec/rspec/matchers/start_with_end_with_spec.rb +0 -186
  148. data/spec/rspec/matchers/throw_symbol_spec.rb +0 -116
  149. data/spec/rspec/matchers/yield_spec.rb +0 -514
  150. data/spec/spec_helper.rb +0 -54
  151. data/spec/support/classes.rb +0 -56
  152. data/spec/support/in_sub_process.rb +0 -38
  153. data/spec/support/matchers.rb +0 -22
  154. data/spec/support/ruby_version.rb +0 -10
  155. data/spec/support/shared_examples.rb +0 -13
data/Changelog.md CHANGED
@@ -1,5 +1,956 @@
1
+ ### Development
2
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.12.3...main)
3
+
4
+ ### 3.13.0 / 2024-02-04
5
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.12.4...v3.13.0)
6
+
7
+ Enhancements:
8
+
9
+ * Update `eq` and `eql` matchers to better highlight difference in string encoding.
10
+ (Alan Foster, #1425)
11
+
12
+ ### 3.12.4 / 2024-02-04
13
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.12.3...v3.12.4)
14
+
15
+ Bug Fixes:
16
+
17
+ * Fix the diff for redefined `actual` and reassigned `@actual` in compound
18
+ expectations failure messages. (Phil Pirozhkov, #1440)
19
+
20
+ ### 3.12.3 / 2023-04-20
21
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.12.2...v3.12.3)
22
+
23
+ Bug Fixes:
24
+
25
+ * Fix `include` matcher when fuzzy matching on keys with a hash-like actual which
26
+ has a non standard `key?` method which may raise.
27
+ (Jon Rowe, #1416)
28
+
29
+ ### 3.12.2 / 2023-01-07
30
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.12.1...v3.12.2)
31
+
32
+ Bug Fixes:
33
+
34
+ * Prevent deprecation warning when using the `exist` matcher with `Dir`.
35
+ (Steve Dierker, #1398)
36
+
37
+ ### 3.12.1 / 2022-12-16
38
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.12.0...v3.12.1)
39
+
40
+ Bug Fixes:
41
+
42
+ * Pass keyword arguments through to aliased (and thus negated) matchers. (Jon Rowe, #1394)
43
+ * When handling failures in an aggregated_failures block (or example) prevent
44
+ the failure list leaking out. (Maciek Rząsa, #1392)
45
+
46
+ ### 3.12.0 / 2022-10-26
47
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.11.1...v3.12.0)
48
+
49
+ Enhancements:
50
+
51
+ * Add `an_array_matching` alias for `match_array` to improve readability as an argument
52
+ matcher. (Mark Schneider, #1361)
53
+
54
+ ### 3.11.1 / 2022-09-12
55
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.11.0...v3.11.1)
56
+
57
+ Bug Fixes:
58
+
59
+ * Allow the `contain_exactly` matcher to be reused by resetting its
60
+ internals on `matches?` (@bclayman-sq, #1326)
61
+ * Using the exist matcher on `FileTest` no longer produces a deprecation warning.
62
+ (Ryo Nakamura, #1383)
63
+
64
+ ### 3.11.0 / 2022-02-09
65
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.10.2...v3.11.0)
66
+
67
+ Enhancements:
68
+
69
+ * Return `true` from `aggregate_failures` when no exception occurs. (Jon Rowe, #1225)
70
+
71
+ Deprecations:
72
+
73
+ * Print a deprecation message when using the implicit block expectation syntax.
74
+ (Phil Pirozhkov, #1139)
75
+
76
+ ### 3.10.2 / 2022-01-14
77
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.10.1...v3.10.2)
78
+
79
+ Bug Fixes:
80
+
81
+ * Fix support for dynamic matchers for expectation target checks (Phil Pirozhkov, #1294)
82
+ * Fix `expect(array).to include(hash).times`, previously this would fail due to
83
+ matching the entire array as a single hash, rather than a member of the hash.
84
+ (Slava Kardakov, #1322)
85
+ * Ensure `raise_error` matches works with the `error_highlight` option from Ruby 3.1.
86
+ (Peter Goldstein, #1339)
87
+
88
+ ### 3.10.1 / 2020-12-27
89
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.10.0...v3.10.1)
90
+
91
+ Bug Fixes:
92
+
93
+ * Allow JRuby 9.2.x.x to generate backtraces normally rather than via our
94
+ backfill workaround. (#1230, Jon Rowe)
95
+
96
+ ### 3.10.0 / 2020-10-30
97
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.9.3...v3.10.0)
98
+
99
+ Enhancements:
100
+
101
+ * Allow `include` matcher to be chained with `once`, `at_least`, etc. for simple cases.
102
+ (Marc-André Lafortune, #1168)
103
+ * Add an explicit warning when `nil` is passed to `raise_error`. (Phil Pirozhkov, #1143)
104
+ * Improve `include` matcher's composability. (Phil Pirozhkov, #1155)
105
+ * Mocks expectations can now set a custom failure message.
106
+ (Benoit Tigeot and Nicolas Zermati, #1156)
107
+ * `aggregate_failures` now shows the backtrace line for each failure. (Fabricio Bedin, #1163)
108
+ * Support multiple combinations of `yield_control` modifiers like `at_least`, `at_most`.
109
+ (Jon Rowe, #1169)
110
+ * Dynamic `have_<n>` matchers now have output consistent with other dynamic matchers.
111
+ (Marc-André Lafortune, #1195)
112
+ * New config option `strict_predicate_matchers` allows predicate matcher to be strict
113
+ (i.e. match for `true` or `false`) instead of the default (match truthy vs `false` or `nil`).
114
+ (Marc-André Lafortune, #1196)
115
+
116
+ ### 3.9.4 / 2020-10-29
117
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.9.3...v3.9.4)
118
+
119
+ Bug Fixes:
120
+
121
+ * Fix regression with `be_` and `have_` matchers and arguments implementing `to_hash`
122
+ were they would act like keywords and be cast to a hash. (Jon Rowe, #1222)
123
+
124
+ ### 3.9.3 / 2020-10-23
125
+
126
+ Bug Fixes:
127
+
128
+ * Swap the comparison of the delta vs the expected for the `be_within` matcher allowing
129
+ more complicated oobjects to be compared providing they provide `abs` and other
130
+ comparison methods. (Kelly Stannard, #1182)
131
+ * Properly format expected in the description of the `be_within` matcher. (Jon Rowe, #1185)
132
+ * Remove warning when using keyword arguments with `be_` and `have_` matchers on 2.7.x
133
+ (Jon Rowe, #1187)
134
+ * Prevent formatting a single hash as a list of key value pairs in default failure messages
135
+ for custom matches (fixes formatting in `EnglishPhrasing#list`). (Robert Eshleman, #1193)
136
+ * Prevent errors from causing false positives when using `be <operator>` comparison, e.g.
137
+ `expect(1).not_to be < 'a'` will now correctly fail rather than pass. (Jon Rowe, #1208)
138
+
139
+
140
+ ### 3.9.2 / 2020-05-08
141
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.9.1...v3.9.2)
142
+
143
+ Bug Fixes:
144
+
145
+ * Issue a proper `ArgumentError` when invalid arguments are given to `yield_control`
146
+ modifiers such as `at_least` et al. (Marc-André Lafortune, #1167)
147
+ * Prevent Ruby 2.7 keyword arguments warning from being issued by custom
148
+ matcher definitions. (Jon Rowe, #1176)
149
+
150
+ ### 3.9.1 / 2020-03-13
151
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.9.0...v3.9.1)
152
+
153
+ Bug Fixes:
154
+
155
+ * Issue an improved warning when using `respond_to(...).with(n).arguments` and ignore
156
+ the warning when using with `have_attributes(...)`. (Jon Rowe, #1164)
157
+
158
+ ### 3.9.0 / 2019-10-08
159
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.6...v3.9.0)
160
+
161
+ Enhancements:
162
+
163
+ * The `respond_to` matcher now uses the signature from `initialize` to validate checks
164
+ for `new` (unless `new` is non standard). (Jon Rowe, #1072)
165
+ * Generated descriptions for matchers now use `is expected to` rather than `should` in
166
+ line with our preferred DSL. (Pete Johns, #1080, rspec/rspec-core#2572)
167
+ * Add the ability to re-raise expectation errors when matching
168
+ with `match_when_negated` blocks. (Jon Rowe, #1130)
169
+ * Add a warning when an empty diff is produce due to identical inspect output.
170
+ (Benoit Tigeot, #1126)
171
+
172
+ ### 3.8.6 / 2019-10-07
173
+
174
+ Bug Fixes:
175
+
176
+ * Revert #1125 due to the change being incompatible with our semantic versioning
177
+ policy.
178
+
179
+ ### 3.8.5 / 2019-10-02
180
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.4...v3.8.5)
181
+
182
+ Bug Fixes:
183
+
184
+ * Prevent unsupported implicit block expectation syntax from being used.
185
+ (Phil Pirozhkov, #1125)
186
+
187
+ ### 3.8.4 / 2019-06-10
188
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.3...v3.8.4)
189
+
190
+ Bug Fixes:
191
+
192
+ * Prevent false negatives when checking objects for the methods required to run the
193
+ the `be_an_instance_of` and `be_kind_of` matchers. (Nazar Matus, #1112)
194
+
195
+ ### 3.8.3 / 2019-04-20
196
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.2...v3.8.3)
197
+
198
+ Bug Fixes:
199
+
200
+ * Prevent composed `all` matchers from leaking into their siblings leading to duplicate
201
+ failures. (Jamie English, #1086)
202
+ * Prevent objects which change their hash on comparison from failing change checks.
203
+ (Phil Pirozhkov, #1100)
204
+ * Issue an `ArgumentError` rather than a `NoMethodError` when `be_an_instance_of` and
205
+ `be_kind_of` matchers encounter objects not supporting those methods.
206
+ (Taichi Ishitani, #1107)
207
+
208
+ ### 3.8.2 / 2018-10-09
209
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.1...v3.8.2)
210
+
211
+ Bug Fixes:
212
+
213
+ * Change `include` matcher to rely on a `respond_to?(:include?)` check rather than a direct
214
+ Hash comparison before calling `to_hash` to convert to a hash. (Jordan Owens, #1073)
215
+ * Prevent unexpected call stack jumps from causing an obscure error (`IndexError`), and
216
+ replace that error with a proper informative message. (Jon Rowe, #1076)
217
+
218
+ ### 3.8.1 / 2018-08-06
219
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.0...v3.8.1)
220
+
221
+ Bug Fixes:
222
+
223
+ * Fix regression in `include` matcher so stopped
224
+ `expect(hash.with_indifferent_access).to include(:symbol_key)`
225
+ from working. (Eito Katagiri, #1069)
226
+
227
+ ### 3.8.0 / 2018-08-04
228
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.7.0...v3.8.0)
229
+
230
+ Enhancements:
231
+
232
+ * Improve failure message of `change(receiver, :message)` by including the
233
+ receiver as `SomeClass#some_message`. (Tomohiro Hashidate, #1005)
234
+ * Improve `change` matcher so that it can correctly detect changes in
235
+ deeply nested mutable objects (such as arrays-of-hashes-of-arrays).
236
+ The improved logic uses the before/after `hash` value to see if the
237
+ object has been mutated, rather than shallow duping the object.
238
+ (Myron Marston, #1034)
239
+ * Improve `include` matcher so that pseudo-hash objects (e.g. objects
240
+ that decorate a hash using a `SimpleDelegator` or similar) are treated
241
+ as a hash, as long as they implement `to_hash`. (Pablo Brasero, #1012)
242
+ * Add `max_formatted_output_length=` to configuration, allowing changing
243
+ the length at which we truncate large output strings.
244
+ (Sam Phippen #951, Benoit Tigeot #1056)
245
+ * Improve error message when passing a matcher that doesn't support block
246
+ expectations to a block based `expect`. (@nicktime, #1066)
247
+
248
+ ### 3.7.0 / 2017-10-17
249
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.6.0...v3.7.0)
250
+
251
+ Enhancements:
252
+
253
+ * Improve compatibility with `--enable-frozen-string-literal` option
254
+ on Ruby 2.3+. (Pat Allan, #997)
255
+
256
+ ### 3.6.0 / 2017-05-04
257
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.6.0.beta2...v3.6.0)
258
+
259
+ Enhancements:
260
+
261
+ * Treat NoMethodError as a failure for comparison matchers. (Jon Rowe, #972)
262
+ * Allow for scoped aliased and negated matchers--just call
263
+ `alias_matcher` or `define_negated_matcher` from within an example
264
+ group. (Markus Reiter, #974)
265
+ * Improve failure message of `change` matcher with block and `satisfy` matcher
266
+ by including the block snippet instead of just describing it as `result` or
267
+ `block` when Ripper is available. (Yuji Nakayama, #987)
268
+
269
+ Bug Fixes:
270
+
271
+ * Fix `yield_with_args` and `yield_successive_args` matchers so that
272
+ they compare expected to actual args at the time the args are yielded
273
+ instead of at the end, in case the method that is yielding mutates the
274
+ arguments after yielding. (Alyssa Ross, #965)
275
+
276
+ ### 3.6.0.beta2 / 2016-12-12
277
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.6.0.beta1...v3.6.0.beta2)
278
+
279
+ Bug Fixes:
280
+
281
+ * Using the exist matcher on `File` no longer produces a deprecation warning.
282
+ (Jon Rowe, #954)
283
+
284
+ ### 3.6.0.beta1 / 2016-10-09
285
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0...v3.6.0.beta1)
286
+
287
+ Bug Fixes:
288
+
289
+ * Fix `contain_exactly` to work correctly with ranges. (Myron Marston, #940)
290
+ * Fix `change` to work correctly with sets. (Marcin Gajewski, #939)
291
+
292
+ ### 3.5.0 / 2016-07-01
293
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0.beta4...v3.5.0)
294
+
295
+ Enhancements:
296
+
297
+ * Add support for keyword arguments to the `respond_to` matcher. (Rob Smith, #915).
298
+
299
+ ### 3.5.0.beta4 / 2016-06-05
300
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0.beta3...v3.5.0.beta4)
301
+
302
+ Bug Fixes:
303
+
304
+ * Fix `include` matcher so that it provides a valid diff for hashes. (Yuji Nakayama, #916)
305
+
306
+ ### 3.5.0.beta3 / 2016-04-02
307
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0.beta2...v3.5.0.beta3)
308
+
309
+ Enhancements:
310
+
311
+ * Make `rspec/expectations/minitest_integration` work on Minitest::Spec
312
+ 5.6+. (Myron Marston, #904)
313
+ * Add an alias `having_attributes` for `have_attributes` matcher.
314
+ (Yuji Nakayama, #905)
315
+ * Improve `change` matcher error message when block is mis-used.
316
+ (Alex Altair, #908)
317
+
318
+ ### 3.5.0.beta2 / 2016-03-10
319
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0.beta1...v3.5.0.beta2)
320
+
321
+ Enhancements:
322
+
323
+ * Add the ability to raise an error on encountering false positives via
324
+ `RSpec::Configuration#on_potential_false_positives = :raise`. (Jon Rowe, #900)
325
+ * When using the custom matcher DSL, support new
326
+ `notify_expectation_failures: true` option for the `match` method to
327
+ allow expectation failures to be raised as normal instead of being
328
+ converted into a `false` return value for `matches?`. (Jon Rowe, #892)
329
+
330
+ Bug Fixes:
331
+
332
+ * Allow `should` deprecation check to work on `BasicObject`s. (James Coleman, #898)
333
+
334
+ ### 3.5.0.beta1 / 2016-02-06
335
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.4.0...v3.5.0.beta1)
336
+
337
+ Enhancements:
338
+
339
+ * Make `match_when_negated` in custom matcher DSL support use of
340
+ expectations within the match logic. (Chris Arcand, #789)
341
+
342
+ Bug Fixes:
343
+
344
+ * Return `true` as expected from passing negated expectations
345
+ (such as `expect("foo").not_to eq "bar"`), so they work
346
+ properly when used within a `match` or `match_when_negated`
347
+ block. (Chris Arcand, #789)
348
+
349
+ ### 3.4.0 / 2015-11-11
350
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.3.1...v3.4.0)
351
+
352
+ Enhancements:
353
+
354
+ * Warn when `RSpec::Matchers` is included in a superclass after it has
355
+ already been included in a subclass on MRI 1.9, since that situation
356
+ can cause uses of `super` to trigger infinite recursion. (Myron Marston, #816)
357
+ * Stop rescuing `NoMemoryError`, `SignalExcepetion`, `Interrupt` and
358
+ `SystemExit`. It is dangerous to interfere with these. (Myron Marston, #845)
359
+ * Add `#with_captures` to the match matcher which allows a user to specify expected
360
+ captures when matching a regex against a string. (Sam Phippen, #848)
361
+ * Always print compound failure messages in the multi-line form. Trying
362
+ to print it all on a single line didn't read very well. (Myron Marston, #859)
363
+
364
+ Bug Fixes:
365
+
366
+ * Fix failure message from dynamic predicate matchers when the object
367
+ does not respond to the predicate so that it is inspected rather
368
+ than relying upon its `to_s` -- that way for `nil`, `"nil"` is
369
+ printed rather than an empty string. (Myron Marston, #841)
370
+ * Fix SystemStackError raised when diffing an Enumerable object
371
+ whose `#each` includes the object itself. (Yuji Nakayama, #857)
372
+
373
+ ### 3.3.1 / 2015-07-15
374
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.3.0...v3.3.1)
375
+
376
+ Bug Fixes:
377
+
378
+ * Fix `be >`, `be <`, etc so that it fails rather than allowing an
379
+ argument error to be raised when compared against an object of the
380
+ wrong type. This allows it to be used in composed matcher expressions
381
+ against heterogeneous objects. (Dennis Günnewig, #809)
382
+ * Fix `respond_to` to work properly on target objects
383
+ that redefine the `method` method. (unmanbearpig, #821)
384
+
385
+ ### 3.3.0 / 2015-06-12
386
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.2.1...v3.3.0)
387
+
388
+ Enhancements:
389
+
390
+ * Expose `RSpec::Matchers::EnglishPhrasing` to make it easier to write
391
+ nice failure messages in custom matchers. (Jared Beck, #736)
392
+ * Add `RSpec::Matchers::FailMatchers`, a mixin which provides
393
+ `fail`, `fail_with` and `fail_including` matchers for use in
394
+ specifying that an expectation fails for use by
395
+ extension/plugin authors. (Charlie Rudolph, #729)
396
+ * Avoid loading `tempfile` (and its dependencies) unless
397
+ it is absolutely needed. (Myron Marston, #735)
398
+ * Improve failure output when attempting to use `be_true` or `be_false`.
399
+ (Tim Wade, #744)
400
+ * Define `RSpec::Matchers#respond_to_missing?` so that
401
+ `RSpec::Matchers#respond_to?` and `RSpec::Matchers#method` handle
402
+ dynamic predicate matchers. (Andrei Botalov, #751)
403
+ * Use custom Time/DateTime/BigDecimal formatting for all matchers
404
+ so they are consistently represented in failure messages.
405
+ (Gavin Miller, #740)
406
+ * Add configuration to turn off warnings about matcher combinations that
407
+ may cause false positives. (Jon Rowe, #768)
408
+ * Warn when using a bare `raise_error` matcher that you may be subject to
409
+ false positives. (Jon Rowe, #768)
410
+ * Warn rather than raise when using the`raise_error` matcher in negative
411
+ expectations that may be subject to false positives. (Jon Rowe, #775)
412
+ * Improve failure message for `include(a, b, c)` so that if `a` and `b`
413
+ are included the failure message only mentions `c`. (Chris Arcand, #780)
414
+ * Allow `satisfy` matcher to take an optional description argument
415
+ that will be used in the `description`, `failure_message` and
416
+ `failure_message_when_negated` in place of the undescriptive
417
+ "sastify block". (Chris Arcand, #783)
418
+ * Add new `aggregate_failures` API that allows multiple independent
419
+ expectations to all fail and be listed in the failure output, rather
420
+ than the example aborting on the first failure. (Myron Marston, #776)
421
+ * Improve `raise_error` matcher so that it can accept a matcher as a single argument
422
+ that matches the message. (Time Wade, #782)
423
+
424
+ Bug Fixes:
425
+
426
+ * Make `contain_exactly` / `match_array` work with strict test doubles
427
+ that have not defined `<=>`. (Myron Marston, #758)
428
+ * Fix `include` matcher so that it omits the diff when it would
429
+ confusingly highlight items that are actually included but are not
430
+ an exact match in a line-by-line diff. (Tim Wade, #763)
431
+ * Fix `match` matcher so that it does not blow up when matching a string
432
+ or regex against another matcher (rather than a string or regex).
433
+ (Myron Marston, #772)
434
+ * Silence whitespace-only diffs. (Myron Marston, #801)
435
+
436
+ ### 3.2.1 / 2015-04-06
437
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.2.0...v3.2.1)
438
+
439
+ Bug Fixes:
440
+
441
+ * Prevent `Range`s from being enumerated when generating matcher
442
+ descriptions. (Jon Rowe, #755)
443
+ * Ensure exception messages are compared as strings in the `raise_error`
444
+ matcher. (Jon Rowe, #755)
445
+
446
+ ### 3.2.0 / 2015-02-03
447
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.1.2...v3.2.0)
448
+
449
+ Enhancements:
450
+
451
+ * Add `block_arg` method to custom matcher API, which allows you to
452
+ access the block passed to a custom matcher, if there is one.
453
+ (Mike Dalton, #645)
454
+ * Provide more detail in failure message of `yield_control` matcher.
455
+ (Jon Rowe, #650)
456
+ * Add a shorthand syntax for `chain` in the matcher DSL which assigns values
457
+ for use elsewhere, for example `chain :and_smaller_than, :small_value`
458
+ creates an `attr_reader` for `small_value` (Tom Stuart, #644)
459
+ * Provide a more helpful deprecation message when using the `should` syntax.
460
+ (Elia Schito, #663)
461
+ * Provide more detail in the `have_attributes` matcher failure message.
462
+ (Jon Rowe, #668)
463
+ * Make the `have_attributes` matcher diffable.
464
+ (Jon Rowe, Alexey Fedorov, #668)
465
+ * Add `output(...).to_std(out|err)_from_any_process` as alternatives
466
+ to `output(...).to_std(out|err)`. The latter doesn't work when a sub
467
+ process writes to the named stream but is much faster.
468
+ (Alex Genco, #700)
469
+ * Improve compound matchers (created by `and` and `or`) so that diffs
470
+ are included in failures when one or more of their matchers
471
+ are diffable. (Alexey Fedorov, #713)
472
+
473
+ Bug Fixes:
474
+
475
+ * Avoid calling `private_methods` from the `be` predicate matcher on
476
+ the target object if the object publicly responds to the predicate
477
+ method. This avoids a possible error that can occur if the object
478
+ raises errors from `private_methods` (which can happen with celluloid
479
+ objects). (@chapmajs, #670)
480
+ * Make `yield_control` (with no modifier) default to
481
+ `at_least(:once)` rather than raising a confusing error
482
+ when multiple yields are encountered.
483
+ (Myron Marston, #675)
484
+ * Fix "instance variable @color not initialized" warning when using
485
+ rspec-expectations outside of an rspec-core context. (Myron Marston, #689)
486
+ * Fix `start_with` and `end_with` to work properly when checking a
487
+ string against an array of strings. (Myron Marston, #690)
488
+ * Don't use internally delegated matchers when generating descriptions
489
+ for examples without doc strings. (Myron Marston, #692)
490
+
491
+ ### 3.1.2 / 2014-09-26
492
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.1.1...v3.1.2)
493
+
494
+ Bug Fixes:
495
+
496
+ * Fix `define_negated_matcher` so that matchers that support fluent
497
+ interfaces continue to be negated after you use the chained method.
498
+ (Myron Marston, #656)
499
+ * Fix `define_negated_matcher` so that the matchers fail with an
500
+ appropriate failure message. (Myron Marston, #659)
501
+
502
+ ### 3.1.1 / 2014-09-15
503
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.1.0...v3.1.1)
504
+
505
+ Bug Fixes:
506
+
507
+ * Fix regression in `all` matcher in 3.1.0 that prevented it from
508
+ working on objects that are not `Enumerable` but do implement
509
+ `each_with_index` (such as an ActiveRecord proxy). (Jori Hardman, #647)
510
+
511
+ ### 3.1.0 / 2014-09-04
512
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.4...v3.1.0)
513
+
514
+ Enhancements:
515
+
516
+ * Add `have_attributes` matcher, that passes if actual's attribute
517
+ values match the expected attributes hash:
518
+ `Person = Struct.new(:name, :age)`
519
+ `person = Person.new("Bob", 32)`
520
+ `expect(person).to have_attributes(:name => "Bob", :age => 32)`.
521
+ (Adam Farhi, #571)
522
+ * Extended compound matcher support to block matchers, for cases like:
523
+ `expect { ... }.to change { x }.to(3).and change { y }.to(4)`. (Myron
524
+ Marston, #567)
525
+ * Include chained methods in custom matcher description and failure message
526
+ when new `include_chain_clauses_in_custom_matcher_descriptions` config
527
+ option is enabled. (Dan Oved, #600)
528
+ * Add `thrice` modifier to `yield_control` matcher as a synonym for
529
+ `exactly(3).times`. (Dennis Taylor, #615)
530
+ * Add `RSpec::Matchers.define_negated_matcher`, which defines a negated
531
+ version of the named matcher. (Adam Farhi, Myron Marston, #618)
532
+ * Document and support negation of `contain_exactly`/`match_array`.
533
+ (Jon Rowe, #626).
534
+
535
+ Bug Fixes:
536
+
537
+ * Rename private `LegacyMacherAdapter` constant to `LegacyMatcherAdapter`
538
+ to fix typo. (Abdelkader Boudih, #563)
539
+ * Fix `all` matcher so that it fails properly (rather than raising a
540
+ `NoMethodError`) when matched against a non-enumerable. (Hao Su, #622)
541
+
542
+ ### 3.0.4 / 2014-08-14
543
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.3...v3.0.4)
544
+
545
+ Bug Fixes:
546
+
547
+ * Fix `start_with` and `end_with` so that they work properly with
548
+ structs. (Myron Marston, #620)
549
+ * Fix failure message generation so that structs are printed properly
550
+ in failures. Previously failure messages would represent them as
551
+ an array. (Myron Marston, #620)
552
+ * Fix composable matcher support so that it does not wrongly treat
553
+ structs as arrays. (Myron Marston, #620)
554
+
555
+ ### 3.0.3 / 2014-07-21
556
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.2...v3.0.3)
557
+
558
+ Bug Fixes:
559
+
560
+ * Fix issue with detection of generic operator matchers so they work
561
+ correctly when undefined. (Myron Marston, #597)
562
+ * Don't inadvertently define `BasicObject` in 1.8.7. (Chris Griego, #603)
563
+ * Fix `include` matcher so that it fails gracefully when matched against
564
+ an object that does not respond to `include?`. (Myron Marston, #607)
565
+
566
+ ### 3.0.2 / 2014-06-19
567
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.1...v3.0.2)
568
+
569
+ Bug Fixes:
570
+
571
+ * Fix regression in `contain_exactly` (AKA `match_array`) that caused it
572
+ to wrongly pass when the expected array was empty. (Myron Marston, #581)
573
+ * Provide a better error message when you use the `change(obj, :msg)`
574
+ form of the change matcher but forget the message argument. (Alex
575
+ Sunderland, #585)
576
+ * Make the `contain_exactly` matcher work with arrays that contain hashes in
577
+ arbitrary ordering. (Sam Phippen, #578)
578
+
579
+ ### 3.0.1 / 2014-06-12
580
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.0...v3.0.1)
581
+
582
+ Bug Fixes:
583
+
584
+ * Add a missing `require` that would cause the `respond_to` matcher to
585
+ fail when used in a project where the rest of RSpec (e.g. core and
586
+ expecatations) weren't being used. (Myron Marston, #566)
587
+ * Structs are no longer treated as arrays when diffed. (Jon Rowe, #576)
588
+
589
+ ### 3.0.0 / 2014-06-01
590
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.0.rc1...v3.0.0)
591
+
592
+ No code changes. Just taking it out of pre-release.
593
+
594
+ ### 3.0.0.rc1 / 2014-05-18
595
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.0.beta2...v3.0.0.rc1)
596
+
597
+ Breaking Changes for 3.0.0:
598
+
599
+ * Remove `matcher_execution_context` attribute from DSL-defined
600
+ custom matchers. (Myron Marston)
601
+ * Remove `RSpec::Matchers::Pretty#_pretty_print`. (Myron Marston)
602
+ * Remove `RSpec::Matchers::Pretty#expected_to_sentence`. (Myron Marston)
603
+ * Rename `RSpec::Matchers::Configuration` constant to
604
+ `RSpec::Expectations::Configuration`. (Myron Marston)
605
+ * Prevent `have_xyz` predicate matchers using private methods.
606
+ (Adrian Gonzalez)
607
+ * Block matchers must now implement `supports_block_expectations?`.
608
+ (Myron Marston)
609
+ * Stop supporting `require 'rspec-expectations'`.
610
+ Use `require 'rspec/expectations'` instead. (Myron Marston)
611
+
612
+ Bug Fixes:
613
+
614
+ * Fix `NoMethodError` triggered by beta2 when `YARD` was loaded in
615
+ the test environment. (Myron Marston)
616
+ * Fix `be_xyz` matcher to accept a `do...end` block. (Myron Marston)
617
+ * Fix composable matcher failure message generation logic
618
+ so that it does not blow up when given `$stdout` or `$stderr`.
619
+ (Myron Marston)
620
+ * Fix `change` matcher to work properly with `IO` objects.
621
+ (Myron Marston)
622
+ * Fix `exist` matcher so that it can be used in composed matcher
623
+ expressions involving objects that do not implement `exist?` or
624
+ `exists?`. (Daniel Fone)
625
+ * Fix composable matcher match logic so that it clones matchers
626
+ before using them in order to work properly with matchers
627
+ that use internal memoization based on a given `actual` value.
628
+ (Myron Marston)
629
+ * Fix `be_xyz` and `has_xyz` predicate matchers so that they can
630
+ be used in composed matcher expressions involving objects that
631
+ do not implement the predicate method. (Daniel Fone)
632
+
633
+ Enhancements:
634
+
635
+ * Document the remaining public APIs. rspec-expectations now has 100% of
636
+ the public API documented and will remain that way (as new undocumented
637
+ methods will fail the build). (Myron Marston)
638
+ * Improve the formatting of BigDecimal objects in `eq` matcher failure
639
+ messages. (Daniel Fone)
640
+ * Improve the failure message for `be_xyz` predicate matchers so
641
+ that it includes the `inspect` output of the receiver.
642
+ (Erik Michaels-Ober, Sam Phippen)
643
+ * Add `all` matcher, to allow you to specify that a given matcher
644
+ matches all elements in a collection:
645
+ `expect([1, 3, 5]).to all( be_odd )`. (Adam Farhi)
646
+ * Add boolean aliases (`&`/`|`) for compound operators (`and`/`or`). (Adam Farhi)
647
+ * Give users a clear error when they wrongly use a value matcher
648
+ in a block expectation expression (e.g. `expect { 3 }.to eq(3)`)
649
+ or vice versa. (Myron Marston)
650
+
651
+ ### 3.0.0.beta2 / 2014-02-17
652
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.0.beta1...v3.0.0.beta2)
653
+
654
+ Breaking Changes for 3.0.0:
655
+
656
+ * Remove deprecated support for accessing the `RSpec` constant using
657
+ `Rspec` or `Spec`. (Myron Marston)
658
+ * Remove deprecated `RSpec::Expectations.differ=`. (Myron Marston)
659
+ * Remove support for deprecated `expect(...).should`. (Myron Marston)
660
+ * Explicitly disallow `expect { }.not_to change { }` with `by`,
661
+ `by_at_least`, `by_at_most` or `to`. These have never been supported
662
+ but did not raise explicit errors. (Myron Marston)
663
+ * Provide `===` rather than `==` as an alias of `matches?` for
664
+ all matchers. The semantics of `===` are closer to an RSpec
665
+ matcher than `==`. (Myron Marston)
666
+ * Remove deprecated `RSpec::Matchers::OperatorMatcher` constant.
667
+ (Myron Marston)
668
+ * Make `RSpec::Expectations::ExpectationNotMetError` subclass
669
+ `Exception` rather than `StandardError` so they can bypass
670
+ a bare `rescue` in end-user code (e.g. when an expectation is
671
+ set from within a rspec-mocks stub implementation). (Myron Marston)
672
+ * Remove Test::Unit and Minitest 4.x integration. (Myron Marston)
673
+
674
+ Enhancements:
675
+
676
+ * Simplify the failure message of the `be` matcher when matching against:
677
+ `true`, `false` and `nil`. (Sam Phippen)
678
+ * Update matcher protocol and custom matcher DSL to better align
679
+ with the newer `expect` syntax. If you want your matchers to
680
+ maintain compatibility with multiple versions of RSpec, you can
681
+ alias the new names to the old. (Myron Marston)
682
+ * `failure_message_for_should` => `failure_message`
683
+ * `failure_message_for_should_not` => `failure_message_when_negated`
684
+ * `match_for_should` => `match`
685
+ * `match_for_should_not` => `match_when_negated`
686
+ * Improve generated descriptions from `change` matcher. (Myron Marston)
687
+ * Add support for compound matcher expressions using `and` and `or`.
688
+ Simply chain them off of any existing matcher to create an expression
689
+ like `expect(alphabet).to start_with("a").and end_with("z")`.
690
+ (Eloy Espinaco)
691
+ * Add `contain_exactly` as a less ambiguous version of `match_array`.
692
+ Note that it expects the expected array to be splatted as
693
+ individual args: `expect(array).to contain_exactly(1, 2)` is
694
+ the same as `expect(array).to match_array([1, 2])`. (Myron Marston)
695
+ * Update `contain_exactly`/`match_array` so that it can match against
696
+ other non-array collections (such as a `Set`). (Myron Marston)
697
+ * Update built-in matchers so that they can accept matchers as arguments
698
+ to allow you to compose matchers in arbitrary ways. (Myron Marston)
699
+ * Add `RSpec::Matchers::Composable` mixin that can be used to make
700
+ a custom matcher composable as well. Note that custom matchers
701
+ defined via `RSpec::Matchers.define` already have this. (Myron
702
+ Marston)
703
+ * Define noun-phrase aliases for built-in matchers, which can be
704
+ used when creating composed matcher expressions that read better
705
+ and provide better failure messages. (Myron Marston)
706
+ * Add `RSpec::Matchers.alias_matcher` so users can define their own
707
+ matcher aliases. The `description` of the matcher will reflect the
708
+ alternate matcher name. (Myron Marston)
709
+ * Add explicit `be_between` matcher. `be_between` has worked for a
710
+ long time as a dynamic predicate matcher, but the failure message
711
+ was suboptimal. The new matcher provides a much better failure
712
+ message. (Erik Michaels-Ober)
713
+ * Enhance the `be_between` matcher to allow for `inclusive` or `exclusive`
714
+ comparison (e.g. inclusive of min/max or exclusive of min/max).
715
+ (Pedro Gimenez)
716
+ * Make failure message for `not_to be #{operator}` less confusing by
717
+ only saying it's confusing when comparison operators are used.
718
+ (Prathamesh Sonpatki)
719
+ * Improve failure message of `eq` matcher when `Time` or `DateTime`
720
+ objects are used so that the full sub-second precision is included.
721
+ (Thomas Holmes, Jeff Wallace)
722
+ * Add `output` matcher for expecting that a block outputs `to_stdout`
723
+ or `to_stderr`. (Luca Pette, Matthias Günther)
724
+ * Forward a provided block on to the `has_xyz?` method call when
725
+ the `have_xyz` matcher is used. (Damian Galarza)
726
+ * Provide integration with Minitest 5.x. Require
727
+ `rspec/expectations/minitest_integration` after loading minitest
728
+ to use rspec-expectations with minitest. (Myron Marston)
729
+
730
+ Bug Fixes:
731
+
732
+ * Fix wrong matcher descriptions with falsey expected value (yujinakayama)
733
+ * Fix `expect { }.not_to change { }.from(x)` so that the matcher only
734
+ passes if the starting value is `x`. (Tyler Rick, Myron Marston)
735
+ * Fix hash diffing, so that it colorizes properly and doesn't consider trailing
736
+ commas when performing the diff. (Jared Norman)
737
+ * Fix built-in matchers to fail normally rather than raising
738
+ `ArgumentError` when given an object of the wrong type to match
739
+ against, so that they work well in composite matcher expressions like
740
+ `expect([1.51, "foo"]).to include(a_string_matching(/foo/), a_value_within(0.1).of(1.5))`.
741
+ (Myron Marston)
742
+
743
+ Deprecations:
744
+
745
+ * Retain support for RSpec 2 matcher protocol (e.g. for matchers
746
+ in 3rd party extension gems like `shoulda`), but it will print
747
+ a deprecation warning. (Myron Marston)
748
+
749
+ ### 3.0.0.beta1 / 2013-11-07
750
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.99.2...v3.0.0.beta1)
751
+
752
+ Breaking Changes for 3.0.0:
753
+
754
+ * Remove explicit support for 1.8.6. (Jon Rowe)
755
+ * Remove the deprecated `be_close` matcher, preferring `be_within` instead.
756
+ (Sam Phippen)
757
+ * Remove the deprecated `have`, `have_at_least` and `have_at_most` matchers.
758
+ You can continue using those matchers through https://github.com/rspec/rspec-collection_matchers,
759
+ or you can rewrite your expectations with something like
760
+ `expect(your_object.size).to eq(num)`. (Hugo Baraúna)
761
+ * Rename `be_true` and `be_false` to `be_truthy` and `be_falsey`. (Sam Phippen)
762
+ * Make `expect { }.to_not raise_error(SomeSpecificClass, message)`,
763
+ `expect { }.to_not raise_error(SomeSpecificClass)` and
764
+ `expect { }.to_not raise_error(message)` invalid, since they are prone
765
+ to hiding failures. Instead, use `expect { }.to_not raise_error` (with no
766
+ args). (Sam Phippen)
767
+ * Within `RSpec::Matchers.define` blocks, helper methods made available
768
+ either via `def self.helper` or `extend HelperModule` are no longer
769
+ available to the `match` block (or any of the others). Instead
770
+ `include` your helper module and define the helper method as an
771
+ instance method. (Myron Marston)
772
+ * Force upgrading Diff::LCS for encoding compatability with diffs. (Jon Rowe)
773
+
774
+ Enhancements:
775
+
776
+ * Support `do..end` style block with `raise_error` matcher. (Yuji Nakayama)
777
+ * Rewrote custom matcher DSL to simplify its implementation and solve a
778
+ few issues. (Myron Marston)
779
+ * Allow early `return` from within custom matcher DSL blocks. (Myron
780
+ Marston)
781
+ * The custom matcher DSL's `chain` can now accept a block. (Myron
782
+ Marston)
783
+ * Support setting an expectation on a `raise_error` matcher via a chained
784
+ `with_message` method call. (Sam Phippen)
785
+
786
+ Bug Fixes:
787
+
788
+ * Allow `include` and `match` matchers to be used from within a
789
+ DSL-defined custom matcher's `match` block. (Myron Marston)
790
+ * Correct encoding error message on diff failure (Jon Rowe)
791
+
792
+ Deprecations:
793
+
794
+ * Using the old `:should` syntax without explicitly configuring it is deprecated.
795
+ It will continue to work but will emit a deprecation warning in RSpec 3 if
796
+ you do not explicitly enable it. (Sam Phippen)
797
+
798
+ ### 2.99.2 / 2014-07-21
799
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.99.1...v2.99.2)
800
+
801
+ Bug Fixes:
802
+
803
+ * Fix regression in `Expectations#method_handle_for` where proxy objects
804
+ with method delegated would wrongly not return a method handle.
805
+ (Jon Rowe, #594)
806
+ * Fix issue with detection of generic operator matchers so they work
807
+ correctly when undefined. (Myron Marston, #597)
808
+
809
+ ### 2.99.1 / 2014-06-19
810
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.99.0...v2.99.1)
811
+
812
+ Bug Fixes:
813
+
814
+ * Fix typo in custom matcher `expected` deprecation warning -- it's
815
+ `expected_as_array`, not `expected_array`. (Frederick Cheung, #562)
816
+
817
+ ### 2.99.0 / 2014-06-01
818
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.99.0.rc1...v2.99.0)
819
+
820
+ Enhancements:
821
+
822
+ * Special case deprecation message for `errors_on` with `rspec-rails` to be more useful.
823
+ (Aaron Kromer)
824
+
825
+ ### 2.99.0.rc1 / 2014-05-18
826
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.99.0.beta2...2.99.0.rc1)
827
+
828
+ Deprecations:
829
+
830
+ * Deprecate `matcher_execution_context` attribute on DSL-defined
831
+ custom matchers. (Myron Marston)
832
+ * Deprecate `RSpec::Matchers::Pretty#_pretty_print`. (Myron Marston)
833
+ * Deprecate `RSpec::Matchers::Pretty#expected_to_sentence`. (Myron Marston)
834
+ * Deprecate `RSpec::Matchers::Configuration` in favor of
835
+ `RSpec::Expectations::Configuration`. (Myron Marston)
836
+ * Deprecate `be_xyz` predicate matcher on an object that doesn't respond to
837
+ `xyz?` or `xyzs?`. (Daniel Fone)
838
+ * Deprecate `have_xyz` matcher on an object that doesn't respond to `has_xyz?`.
839
+ (Daniel Fone)
840
+ * Deprecate `have_xyz` matcher on an object that has a private method `has_xyz?`.
841
+ (Jon Rowe)
842
+ * Issue a deprecation warning when a block expectation expression is
843
+ used with a matcher that doesn't explicitly support block expectations
844
+ via `supports_block_expectations?`. (Myron Marston)
845
+ * Deprecate `require 'rspec-expectations'`. Use
846
+ `require 'rspec/expectations'` instead. (Myron Marston)
847
+
848
+ ### 2.99.0.beta2 / 2014-02-17
849
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.99.0.beta1...v2.99.0.beta2)
850
+
851
+ Deprecations:
852
+
853
+ * Deprecate chaining `by`, `by_at_least`, `by_at_most` or `to` off of
854
+ `expect { }.not_to change { }`. The docs have always said these are
855
+ not supported for the negative form but now they explicitly raise
856
+ errors in RSpec 3. (Myron Marston)
857
+ * Change the semantics of `expect { }.not_to change { x }.from(y)`.
858
+ In RSpec 2.x, this expectation would only fail if `x` started with
859
+ the value of `y` and changed. If it started with a different value
860
+ and changed, it would pass. In RSpec 3, it will pass only if the
861
+ value starts at `y` and it does not change. (Myron Marston)
862
+ * Deprecate `matcher == value` as an alias for `matcher.matches?(value)`,
863
+ in favor of `matcher === value`. (Myron Marston)
864
+ * Deprecate `RSpec::Matchers::OperatorMatcher` in favor of
865
+ `RSpec::Matchers::BuiltIn::OperatorMatcher`. (Myron Marston)
866
+ * Deprecate auto-integration with Test::Unit and minitest.
867
+ Instead, include `RSpec::Matchers` in the appropriate test case
868
+ base class yourself. (Myron Marston)
869
+ * Deprecate treating `#expected` on a DSL-generated custom matcher
870
+ as an array when only 1 argument is passed to the matcher method.
871
+ In RSpec 3 it will be the single value in order to make diffs
872
+ work properly. (Jon Rowe)
873
+
874
+ ### 2.99.0.beta1 / 2013-11-07
875
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.4...v2.99.0.beta1)
876
+
877
+ Deprecations
878
+
879
+ * Deprecate `have`, `have_at_least` and `have_at_most`. You can continue using those
880
+ matchers through https://github.com/rspec/rspec-collection_matchers, or
881
+ you can rewrite your expectations with something like
882
+ `expect(your_object.size).to eq(num)`. (Hugo Baraúna)
883
+ * Deprecate `be_xyz` predicate matcher when `xyz?` is a private method.
884
+ (Jon Rowe)
885
+ * Deprecate `be_true`/`be_false` in favour of `be_truthy`/`be_falsey`
886
+ (for Ruby's conditional semantics) or `be true`/`be false`
887
+ (for exact equality). (Sam Phippen)
888
+ * Deprecate calling helper methods from a custom matcher with the wrong
889
+ scope. (Myron Marston)
890
+ * `def self.foo` / `extend Helper` can be used to add macro methods
891
+ (e.g. methods that call the custom matcher DSL methods), but should
892
+ not be used to define helper methods called from within the DSL
893
+ blocks.
894
+ * `def foo` / `include Helper` is the opposite: it's for helper methods
895
+ callable from within a DSL block, but not for defining macros.
896
+ * RSpec 2.x allowed helper methods defined either way to be used for
897
+ either purpose, but RSpec 3.0 will not.
898
+
899
+ ### 2.14.5 / 2014-02-01
900
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.4...v2.14.5)
901
+
902
+ Bug fixes
903
+
904
+ * Fix wrong matcher descriptions with falsey expected value
905
+ (yujinakayama)
906
+
907
+ ### 2.14.4 / 2013-11-06
908
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.3...v2.14.4)
909
+
910
+ Bug fixes
911
+
912
+ * Make the `match` matcher produce a diff output. (Jon Rowe, Ben Moss)
913
+ * Choose encoding for diff's more intelligently, and when all else fails fall
914
+ back to default internal encoding with replacing characters. (Jon Rowe)
915
+
916
+ ### 2.14.3 / 2013-09-22
917
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.2...v2.14.3)
918
+
919
+ Bug fixes
920
+
921
+ * Fix operator matchers (`should` syntax) when `method` is redefined on target.
922
+ (Brandon Turner)
923
+ * Fix diffing of hashes with object based keys. (Jon Rowe)
924
+ * Fix operator matchers (`should` syntax) when operator is defined via
925
+ `method_missing` (Jon Rowe)
926
+
927
+ ### 2.14.2 / 2013-08-14
928
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.1...v2.14.2)
929
+
930
+ Bug fixes
931
+
932
+ * Fix `be_<predicate>` matcher to not support operator chaining like the
933
+ `be` matcher does (e.g. `be == 5`). This led to some odd behaviors
934
+ since `be_<predicate> == anything` returned a `BeComparedTo` matcher
935
+ and was thus always truthy. This was a consequence of the implementation
936
+ (e.g. subclassing the basic `Be` matcher) and was not intended behavior.
937
+ (Myron Marston).
938
+ * Fix `change` matcher to compare using `==` in addition to `===`. This
939
+ is important for an expression like:
940
+ `expect {}.to change { a.class }.from(ClassA).to(ClassB)` because
941
+ `SomeClass === SomeClass` returns false. (Myron Marston)
942
+
943
+ ### 2.14.1 / 2013-08-08
944
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.0...2.14.1)
945
+
946
+ Bug fixes
947
+
948
+ * Ensure diff output uses the same encoding as the encoding of
949
+ the string being diff'd to prevent `Encoding::UndefinedConversionError`
950
+ errors (Jon Rowe).
951
+
1
952
  ### 2.14.0 / 2013-07-06
2
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.0.rc1...v2.14.0)
953
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.0.rc1...v2.14.0)
3
954
 
4
955
  Bug fixes
5
956
 
@@ -11,7 +962,7 @@ Bug fixes
11
962
  change...` (Sam Phippen).
12
963
 
13
964
  ### 2.14.0.rc1 / 2013-05-27
14
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.13.0...v2.14.0.rc1)
965
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.13.0...v2.14.0.rc1)
15
966
 
16
967
  Enhancements
17
968
 
@@ -45,7 +996,7 @@ Deprecations
45
996
  error_ to pass. (Sam Phippen and David Chelimsky)
46
997
 
47
998
  ### 2.13.0 / 2013-02-23
48
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.12.1...v2.13.0)
999
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.12.1...v2.13.0)
49
1000
 
50
1001
  Enhancements
51
1002
 
@@ -76,7 +1027,7 @@ Bug fixes
76
1027
  printed for empty diffs (Myron Marston).
77
1028
 
78
1029
  ### 2.12.1 / 2012-12-15
79
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.12.0...v2.12.1)
1030
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.12.0...v2.12.1)
80
1031
 
81
1032
  Bug fixes
82
1033
 
@@ -88,7 +1039,7 @@ Bug fixes
88
1039
  (Steven Harman)
89
1040
 
90
1041
  ### 2.12.0 / 2012-11-12
91
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.3...v2.12.0)
1042
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.3...v2.12.0)
92
1043
 
93
1044
  Enhancements
94
1045
 
@@ -111,7 +1062,7 @@ Bug fixes
111
1062
  (Tom Stuart)
112
1063
 
113
1064
  ### 2.11.3 / 2012-09-04
114
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.2...v2.11.3)
1065
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.2...v2.11.3)
115
1066
 
116
1067
  Bug fixes
117
1068
 
@@ -127,7 +1078,7 @@ Bug fixes
127
1078
  }.to change { user.last_emailed_at }.to be_within(1.second).of(Time.zone.now)
128
1079
 
129
1080
  ### 2.11.2 / 2012-07-25
130
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.1...v2.11.2)
1081
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.1...v2.11.2)
131
1082
 
132
1083
  Bug fixes
133
1084
 
@@ -136,7 +1087,7 @@ Bug fixes
136
1087
  of the object hierarchy. (Gabriel Gilder)
137
1088
 
138
1089
  ### 2.11.1 / 2012-07-08
139
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.0...v2.11.1)
1090
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.0...v2.11.1)
140
1091
 
141
1092
  Bug fixes
142
1093
 
@@ -145,7 +1096,7 @@ Bug fixes
145
1096
  * `Time`, for example, is a legit alternative.
146
1097
 
147
1098
  ### 2.11.0 / 2012-07-07
148
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.10.0...v2.11.0)
1099
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.10.0...v2.11.0)
149
1100
 
150
1101
  Enhancements
151
1102
 
@@ -168,7 +1119,7 @@ Bug fixes
168
1119
  Marston)
169
1120
 
170
1121
  ### 2.10.0 / 2012-05-03
171
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.9.1...v2.10.0)
1122
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.9.1...v2.10.0)
172
1123
 
173
1124
  Enhancements
174
1125
 
@@ -186,7 +1137,7 @@ Bug fixes
186
1137
  * Fix message-specific specs to pass on Rubinius (John Firebaugh)
187
1138
 
188
1139
  ### 2.9.1 / 2012-04-03
189
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.9.0...v2.9.1)
1140
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.9.0...v2.9.1)
190
1141
 
191
1142
  Bug fixes
192
1143
 
@@ -197,7 +1148,7 @@ Bug fixes
197
1148
  * Fix using execution context methods in nested DSL matchers (mirasrael)
198
1149
 
199
1150
  ### 2.9.0 / 2012-03-17
200
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0...v2.9.0)
1151
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0...v2.9.0)
201
1152
 
202
1153
  Enhancements
203
1154
 
@@ -217,7 +1168,7 @@ Bug fixes
217
1168
 
218
1169
  ### 2.8.0 / 2012-01-04
219
1170
 
220
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0.rc2...v2.8.0)
1171
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0.rc2...v2.8.0)
221
1172
 
222
1173
  Enhancements
223
1174
 
@@ -226,13 +1177,13 @@ Enhancements
226
1177
 
227
1178
  ### 2.8.0.rc2 / 2011-12-19
228
1179
 
229
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0.rc1...v2.8.0.rc2)
1180
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0.rc1...v2.8.0.rc2)
230
1181
 
231
1182
  No changes for this release. Just releasing with the other rspec gems.
232
1183
 
233
1184
  ### 2.8.0.rc1 / 2011-11-06
234
1185
 
235
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.7.0...v2.8.0.rc1)
1186
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.7.0...v2.8.0.rc1)
236
1187
 
237
1188
  Enhancements
238
1189
 
@@ -241,7 +1192,7 @@ Enhancements
241
1192
 
242
1193
  ### 2.7.0 / 2011-10-16
243
1194
 
244
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.6.0...v2.7.0)
1195
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.6.0...v2.7.0)
245
1196
 
246
1197
  Enhancements
247
1198
 
@@ -259,7 +1210,7 @@ Bug fixes
259
1210
 
260
1211
  ### 2.6.0 / 2011-05-12
261
1212
 
262
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.5.0...v2.6.0)
1213
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.5.0...v2.6.0)
263
1214
 
264
1215
  Enhancements
265
1216
 
@@ -277,7 +1228,7 @@ Bug fixes
277
1228
 
278
1229
  ### 2.5.0 / 2011-02-05
279
1230
 
280
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.4.0...v2.5.0)
1231
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.4.0...v2.5.0)
281
1232
 
282
1233
  Enhancements
283
1234
 
@@ -290,7 +1241,7 @@ Documentation
290
1241
 
291
1242
  ### 2.4.0 / 2011-01-02
292
1243
 
293
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.3.0...v2.4.0)
1244
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.3.0...v2.4.0)
294
1245
 
295
1246
  No functional changes in this release, which was made to align with the
296
1247
  rspec-core-2.4.0 release.
@@ -301,7 +1252,7 @@ Enhancements
301
1252
 
302
1253
  ### 2.3.0 / 2010-12-12
303
1254
 
304
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.2.1...v2.3.0)
1255
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.2.1...v2.3.0)
305
1256
 
306
1257
  Enhancements
307
1258
 
@@ -309,11 +1260,11 @@ Enhancements
309
1260
 
310
1261
  ### 2.2.0 / 2010-11-28
311
1262
 
312
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.1.0...v2.2.0)
1263
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.1.0...v2.2.0)
313
1264
 
314
1265
  ### 2.1.0 / 2010-11-07
315
1266
 
316
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.1...v2.1.0)
1267
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.1...v2.1.0)
317
1268
 
318
1269
  Enhancements
319
1270
 
@@ -332,7 +1283,7 @@ Bug fixes
332
1283
 
333
1284
  ### 2.0.0 / 2010-10-10
334
1285
 
335
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.rc...v2.0.0)
1286
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.rc...v2.0.0)
336
1287
 
337
1288
  Enhancements
338
1289
 
@@ -347,7 +1298,7 @@ Bug fixes
347
1298
 
348
1299
  ### 2.0.0.rc / 2010-10-05
349
1300
 
350
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.beta.22...v2.0.0.rc)
1301
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.beta.22...v2.0.0.rc)
351
1302
 
352
1303
  Enhancements
353
1304
 
@@ -360,7 +1311,7 @@ Bug fixes
360
1311
 
361
1312
  ### 2.0.0.beta.22 / 2010-09-12
362
1313
 
363
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.beta.20...v2.0.0.beta.22)
1314
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.beta.20...v2.0.0.beta.22)
364
1315
 
365
1316
  Enhancements
366
1317