rspec-expectations 2.11.3 → 3.11.0

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