rspec-expectations 3.0.4 → 3.12.3
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.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data/.document +1 -1
- data/.yardopts +1 -1
- data/Changelog.md +530 -5
- data/{License.txt → LICENSE.md} +5 -4
- data/README.md +73 -31
- data/lib/rspec/expectations/block_snippet_extractor.rb +253 -0
- data/lib/rspec/expectations/configuration.rb +96 -1
- data/lib/rspec/expectations/expectation_target.rb +82 -38
- data/lib/rspec/expectations/fail_with.rb +11 -6
- data/lib/rspec/expectations/failure_aggregator.rb +229 -0
- data/lib/rspec/expectations/handler.rb +36 -15
- data/lib/rspec/expectations/minitest_integration.rb +43 -2
- data/lib/rspec/expectations/syntax.rb +5 -5
- data/lib/rspec/expectations/version.rb +1 -1
- data/lib/rspec/expectations.rb +15 -1
- data/lib/rspec/matchers/aliased_matcher.rb +79 -4
- data/lib/rspec/matchers/built_in/all.rb +11 -0
- data/lib/rspec/matchers/built_in/base_matcher.rb +111 -28
- data/lib/rspec/matchers/built_in/be.rb +28 -114
- data/lib/rspec/matchers/built_in/be_between.rb +1 -1
- data/lib/rspec/matchers/built_in/be_instance_of.rb +5 -1
- data/lib/rspec/matchers/built_in/be_kind_of.rb +5 -1
- data/lib/rspec/matchers/built_in/be_within.rb +5 -12
- data/lib/rspec/matchers/built_in/change.rb +171 -63
- data/lib/rspec/matchers/built_in/compound.rb +201 -30
- data/lib/rspec/matchers/built_in/contain_exactly.rb +73 -12
- data/lib/rspec/matchers/built_in/count_expectation.rb +169 -0
- data/lib/rspec/matchers/built_in/eq.rb +3 -38
- data/lib/rspec/matchers/built_in/eql.rb +2 -2
- data/lib/rspec/matchers/built_in/equal.rb +3 -3
- data/lib/rspec/matchers/built_in/exist.rb +7 -3
- data/lib/rspec/matchers/built_in/has.rb +93 -30
- data/lib/rspec/matchers/built_in/have_attributes.rb +114 -0
- data/lib/rspec/matchers/built_in/include.rb +133 -25
- data/lib/rspec/matchers/built_in/match.rb +79 -2
- data/lib/rspec/matchers/built_in/operators.rb +14 -5
- data/lib/rspec/matchers/built_in/output.rb +59 -2
- data/lib/rspec/matchers/built_in/raise_error.rb +130 -27
- data/lib/rspec/matchers/built_in/respond_to.rb +117 -15
- data/lib/rspec/matchers/built_in/satisfy.rb +28 -14
- data/lib/rspec/matchers/built_in/{start_and_end_with.rb → start_or_end_with.rb} +20 -8
- data/lib/rspec/matchers/built_in/throw_symbol.rb +15 -5
- data/lib/rspec/matchers/built_in/yield.rb +129 -156
- data/lib/rspec/matchers/built_in.rb +5 -3
- data/lib/rspec/matchers/composable.rb +24 -36
- data/lib/rspec/matchers/dsl.rb +203 -37
- data/lib/rspec/matchers/english_phrasing.rb +58 -0
- data/lib/rspec/matchers/expecteds_for_multiple_diffs.rb +82 -0
- data/lib/rspec/matchers/fail_matchers.rb +42 -0
- data/lib/rspec/matchers/generated_descriptions.rb +1 -2
- data/lib/rspec/matchers/matcher_delegator.rb +3 -4
- data/lib/rspec/matchers/matcher_protocol.rb +105 -0
- data/lib/rspec/matchers.rb +267 -144
- data.tar.gz.sig +0 -0
- metadata +71 -49
- metadata.gz.sig +0 -0
- data/lib/rspec/matchers/pretty.rb +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d167a03fcf6e4519b628fefcf03b644e6436e1f6769058d84431fab3181e5119
|
4
|
+
data.tar.gz: dccb3d8b5ed822e523989e59e897085584173d65a503be30166b9d14bba675ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc027c3d982da4f60e13924ef494fe4df964ee64ccd405eaf69a522494e23d394d0560dfa32c2007a8f43831118ad20df6480ed5692dbe70b389dfcc724e7266
|
7
|
+
data.tar.gz: 61e1c4f7ce7514869e63d24e7eb3270861ea4ad6343c34127b04f757bd80009dd599ae94be25c925b1de265fb4dc5a68f9619b9e3293de46b4aabd0cd1595dae
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.document
CHANGED
data/.yardopts
CHANGED
data/Changelog.md
CHANGED
@@ -1,3 +1,528 @@
|
|
1
|
+
### Development
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.12.3...3-12-maintenance)
|
3
|
+
|
4
|
+
### 3.12.3 / 2023-04-20
|
5
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.12.2...v3.12.3)
|
6
|
+
|
7
|
+
Bug Fixes:
|
8
|
+
|
9
|
+
* Fix `include` matcher when fuzzy matching on keys with a hash-like actual which
|
10
|
+
has a non standard `key?` method which may raise.
|
11
|
+
(Jon Rowe, #1416)
|
12
|
+
|
13
|
+
### 3.12.2 / 2023-01-07
|
14
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.12.1...v3.12.2)
|
15
|
+
|
16
|
+
Bug Fixes:
|
17
|
+
|
18
|
+
* Prevent deprecation warning when using the `exist` matcher with `Dir`.
|
19
|
+
(Steve Dierker, #1398)
|
20
|
+
|
21
|
+
### 3.12.1 / 2022-12-16
|
22
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.12.0...v3.12.1)
|
23
|
+
|
24
|
+
Bug Fixes:
|
25
|
+
|
26
|
+
* Pass keyword arguments through to aliased (and thus negated) matchers. (Jon Rowe, #1394)
|
27
|
+
* When handling failures in an aggregated_failures block (or example) prevent
|
28
|
+
the failure list leaking out. (Maciek Rząsa, #1392)
|
29
|
+
|
30
|
+
### 3.12.0 / 2022-10-26
|
31
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.11.1...v3.12.0)
|
32
|
+
|
33
|
+
Enhancements:
|
34
|
+
|
35
|
+
* Add `an_array_matching` alias for `match_array` to improve readability as an argument
|
36
|
+
matcher. (Mark Schneider, #1361)
|
37
|
+
|
38
|
+
### 3.11.1 / 2022-09-12
|
39
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.11.0...v3.11.1)
|
40
|
+
|
41
|
+
Bug Fixes:
|
42
|
+
|
43
|
+
* Allow the `contain_exactly` matcher to be reused by resetting its
|
44
|
+
internals on `matches?` (@bclayman-sq, #1326)
|
45
|
+
* Using the exist matcher on `FileTest` no longer produces a deprecation warning.
|
46
|
+
(Ryo Nakamura, #1383)
|
47
|
+
|
48
|
+
### 3.11.0 / 2022-02-09
|
49
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.10.2...v3.11.0)
|
50
|
+
|
51
|
+
Enhancements:
|
52
|
+
|
53
|
+
* Return `true` from `aggregate_failures` when no exception occurs. (Jon Rowe, #1225)
|
54
|
+
|
55
|
+
Deprecations:
|
56
|
+
|
57
|
+
* Print a deprecation message when using the implicit block expectation syntax.
|
58
|
+
(Phil Pirozhkov, #1139)
|
59
|
+
|
60
|
+
### 3.10.2 / 2022-01-14
|
61
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.10.1...v3.10.2)
|
62
|
+
|
63
|
+
Bug Fixes:
|
64
|
+
|
65
|
+
* Fix support for dynamic matchers for expectation target checks (Phil Pirozhkov, #1294)
|
66
|
+
* Fix `expect(array).to include(hash).times`, previously this would fail due to
|
67
|
+
matching the entire array as a single hash, rather than a member of the hash.
|
68
|
+
(Slava Kardakov, #1322)
|
69
|
+
* Ensure `raise_error` matches works with the `error_highlight` option from Ruby 3.1.
|
70
|
+
(Peter Goldstein, #1339)
|
71
|
+
|
72
|
+
### 3.10.1 / 2020-12-27
|
73
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.10.0...v3.10.1)
|
74
|
+
|
75
|
+
Bug Fixes:
|
76
|
+
|
77
|
+
* Allow JRuby 9.2.x.x to generate backtraces normally rather than via our
|
78
|
+
backfill workaround. (#1230, Jon Rowe)
|
79
|
+
|
80
|
+
### 3.10.0 / 2020-10-30
|
81
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.9.3...v3.10.0)
|
82
|
+
|
83
|
+
Enhancements:
|
84
|
+
|
85
|
+
* Allow `include` matcher to be chained with `once`, `at_least`, etc. for simple cases.
|
86
|
+
(Marc-André Lafortune, #1168)
|
87
|
+
* Add an explicit warning when `nil` is passed to `raise_error`. (Phil Pirozhkov, #1143)
|
88
|
+
* Improve `include` matcher's composability. (Phil Pirozhkov, #1155)
|
89
|
+
* Mocks expectations can now set a custom failure message.
|
90
|
+
(Benoit Tigeot and Nicolas Zermati, #1156)
|
91
|
+
* `aggregate_failures` now shows the backtrace line for each failure. (Fabricio Bedin, #1163)
|
92
|
+
* Support multiple combinations of `yield_control` modifiers like `at_least`, `at_most`.
|
93
|
+
(Jon Rowe, #1169)
|
94
|
+
* Dynamic `have_<n>` matchers now have output consistent with other dynamic matchers.
|
95
|
+
(Marc-André Lafortune, #1195)
|
96
|
+
* New config option `strict_predicate_matchers` allows predicate matcher to be strict
|
97
|
+
(i.e. match for `true` or `false`) instead of the default (match truthy vs `false` or `nil`).
|
98
|
+
(Marc-André Lafortune, #1196)
|
99
|
+
|
100
|
+
### 3.9.4 / 2020-10-29
|
101
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.9.3...v3.9.4)
|
102
|
+
|
103
|
+
Bug Fixes:
|
104
|
+
|
105
|
+
* Fix regression with `be_` and `have_` matchers and arguments implementing `to_hash`
|
106
|
+
were they would act like keywords and be cast to a hash. (Jon Rowe, #1222)
|
107
|
+
|
108
|
+
### 3.9.3 / 2020-10-23
|
109
|
+
|
110
|
+
Bug Fixes:
|
111
|
+
|
112
|
+
* Swap the comparison of the delta vs the expected for the `be_within` matcher allowing
|
113
|
+
more complicated oobjects to be compared providing they provide `abs` and other
|
114
|
+
comparison methods. (Kelly Stannard, #1182)
|
115
|
+
* Properly format expected in the description of the `be_within` matcher. (Jon Rowe, #1185)
|
116
|
+
* Remove warning when using keyword arguments with `be_` and `have_` matchers on 2.7.x
|
117
|
+
(Jon Rowe, #1187)
|
118
|
+
* Prevent formatting a single hash as a list of key value pairs in default failure messages
|
119
|
+
for custom matches (fixes formatting in `EnglishPhrasing#list`). (Robert Eshleman, #1193)
|
120
|
+
* Prevent errors from causing false positives when using `be <operator>` comparison, e.g.
|
121
|
+
`expect(1).not_to be < 'a'` will now correctly fail rather than pass. (Jon Rowe, #1208)
|
122
|
+
|
123
|
+
|
124
|
+
### 3.9.2 / 2020-05-08
|
125
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.9.1...v3.9.2)
|
126
|
+
|
127
|
+
Bug Fixes:
|
128
|
+
|
129
|
+
* Issue a proper `ArgumentError` when invalid arguments are given to `yield_control`
|
130
|
+
modifiers such as `at_least` et al. (Marc-André Lafortune, #1167)
|
131
|
+
* Prevent Ruby 2.7 keyword arguments warning from being issued by custom
|
132
|
+
matcher definitions. (Jon Rowe, #1176)
|
133
|
+
|
134
|
+
### 3.9.1 / 2020-03-13
|
135
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.9.0...v3.9.1)
|
136
|
+
|
137
|
+
Bug Fixes:
|
138
|
+
|
139
|
+
* Issue an improved warning when using `respond_to(...).with(n).arguments` and ignore
|
140
|
+
the warning when using with `have_attributes(...)`. (Jon Rowe, #1164)
|
141
|
+
|
142
|
+
### 3.9.0 / 2019-10-08
|
143
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.6...v3.9.0)
|
144
|
+
|
145
|
+
Enhancements:
|
146
|
+
|
147
|
+
* The `respond_to` matcher now uses the signature from `initialize` to validate checks
|
148
|
+
for `new` (unless `new` is non standard). (Jon Rowe, #1072)
|
149
|
+
* Generated descriptions for matchers now use `is expected to` rather than `should` in
|
150
|
+
line with our preferred DSL. (Pete Johns, #1080, rspec/rspec-core#2572)
|
151
|
+
* Add the ability to re-raise expectation errors when matching
|
152
|
+
with `match_when_negated` blocks. (Jon Rowe, #1130)
|
153
|
+
* Add a warning when an empty diff is produce due to identical inspect output.
|
154
|
+
(Benoit Tigeot, #1126)
|
155
|
+
|
156
|
+
### 3.8.6 / 2019-10-07
|
157
|
+
|
158
|
+
Bug Fixes:
|
159
|
+
|
160
|
+
* Revert #1125 due to the change being incompatible with our semantic versioning
|
161
|
+
policy.
|
162
|
+
|
163
|
+
### 3.8.5 / 2019-10-02
|
164
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.4...v3.8.5)
|
165
|
+
|
166
|
+
Bug Fixes:
|
167
|
+
|
168
|
+
* Prevent unsupported implicit block expectation syntax from being used.
|
169
|
+
(Phil Pirozhkov, #1125)
|
170
|
+
|
171
|
+
### 3.8.4 / 2019-06-10
|
172
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.3...v3.8.4)
|
173
|
+
|
174
|
+
Bug Fixes:
|
175
|
+
|
176
|
+
* Prevent false negatives when checking objects for the methods required to run the
|
177
|
+
the `be_an_instance_of` and `be_kind_of` matchers. (Nazar Matus, #1112)
|
178
|
+
|
179
|
+
### 3.8.3 / 2019-04-20
|
180
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.2...v3.8.3)
|
181
|
+
|
182
|
+
Bug Fixes:
|
183
|
+
|
184
|
+
* Prevent composed `all` matchers from leaking into their siblings leading to duplicate
|
185
|
+
failures. (Jamie English, #1086)
|
186
|
+
* Prevent objects which change their hash on comparison from failing change checks.
|
187
|
+
(Phil Pirozhkov, #1100)
|
188
|
+
* Issue an `ArgumentError` rather than a `NoMethodError` when `be_an_instance_of` and
|
189
|
+
`be_kind_of` matchers encounter objects not supporting those methods.
|
190
|
+
(Taichi Ishitani, #1107)
|
191
|
+
|
192
|
+
### 3.8.2 / 2018-10-09
|
193
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.1...v3.8.2)
|
194
|
+
|
195
|
+
Bug Fixes:
|
196
|
+
|
197
|
+
* Change `include` matcher to rely on a `respond_to?(:include?)` check rather than a direct
|
198
|
+
Hash comparison before calling `to_hash` to convert to a hash. (Jordan Owens, #1073)
|
199
|
+
* Prevent unexpected call stack jumps from causing an obscure error (`IndexError`), and
|
200
|
+
replace that error with a proper informative message. (Jon Rowe, #1076)
|
201
|
+
|
202
|
+
### 3.8.1 / 2018-08-06
|
203
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.0...v3.8.1)
|
204
|
+
|
205
|
+
Bug Fixes:
|
206
|
+
|
207
|
+
* Fix regression in `include` matcher so stopped
|
208
|
+
`expect(hash.with_indifferent_access).to include(:symbol_key)`
|
209
|
+
from working. (Eito Katagiri, #1069)
|
210
|
+
|
211
|
+
### 3.8.0 / 2018-08-04
|
212
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.7.0...v3.8.0)
|
213
|
+
|
214
|
+
Enhancements:
|
215
|
+
|
216
|
+
* Improve failure message of `change(receiver, :message)` by including the
|
217
|
+
receiver as `SomeClass#some_message`. (Tomohiro Hashidate, #1005)
|
218
|
+
* Improve `change` matcher so that it can correctly detect changes in
|
219
|
+
deeply nested mutable objects (such as arrays-of-hashes-of-arrays).
|
220
|
+
The improved logic uses the before/after `hash` value to see if the
|
221
|
+
object has been mutated, rather than shallow duping the object.
|
222
|
+
(Myron Marston, #1034)
|
223
|
+
* Improve `include` matcher so that pseudo-hash objects (e.g. objects
|
224
|
+
that decorate a hash using a `SimpleDelegator` or similar) are treated
|
225
|
+
as a hash, as long as they implement `to_hash`. (Pablo Brasero, #1012)
|
226
|
+
* Add `max_formatted_output_length=` to configuration, allowing changing
|
227
|
+
the length at which we truncate large output strings.
|
228
|
+
(Sam Phippen #951, Benoit Tigeot #1056)
|
229
|
+
* Improve error message when passing a matcher that doesn't support block
|
230
|
+
expectations to a block based `expect`. (@nicktime, #1066)
|
231
|
+
|
232
|
+
### 3.7.0 / 2017-10-17
|
233
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.6.0...v3.7.0)
|
234
|
+
|
235
|
+
Enhancements:
|
236
|
+
|
237
|
+
* Improve compatibility with `--enable-frozen-string-literal` option
|
238
|
+
on Ruby 2.3+. (Pat Allan, #997)
|
239
|
+
|
240
|
+
### 3.6.0 / 2017-05-04
|
241
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.6.0.beta2...v3.6.0)
|
242
|
+
|
243
|
+
Enhancements:
|
244
|
+
|
245
|
+
* Treat NoMethodError as a failure for comparison matchers. (Jon Rowe, #972)
|
246
|
+
* Allow for scoped aliased and negated matchers--just call
|
247
|
+
`alias_matcher` or `define_negated_matcher` from within an example
|
248
|
+
group. (Markus Reiter, #974)
|
249
|
+
* Improve failure message of `change` matcher with block and `satisfy` matcher
|
250
|
+
by including the block snippet instead of just describing it as `result` or
|
251
|
+
`block` when Ripper is available. (Yuji Nakayama, #987)
|
252
|
+
|
253
|
+
Bug Fixes:
|
254
|
+
|
255
|
+
* Fix `yield_with_args` and `yield_successive_args` matchers so that
|
256
|
+
they compare expected to actual args at the time the args are yielded
|
257
|
+
instead of at the end, in case the method that is yielding mutates the
|
258
|
+
arguments after yielding. (Alyssa Ross, #965)
|
259
|
+
|
260
|
+
### 3.6.0.beta2 / 2016-12-12
|
261
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.6.0.beta1...v3.6.0.beta2)
|
262
|
+
|
263
|
+
Bug Fixes:
|
264
|
+
|
265
|
+
* Using the exist matcher on `File` no longer produces a deprecation warning.
|
266
|
+
(Jon Rowe, #954)
|
267
|
+
|
268
|
+
### 3.6.0.beta1 / 2016-10-09
|
269
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0...v3.6.0.beta1)
|
270
|
+
|
271
|
+
Bug Fixes:
|
272
|
+
|
273
|
+
* Fix `contain_exactly` to work correctly with ranges. (Myron Marston, #940)
|
274
|
+
* Fix `change` to work correctly with sets. (Marcin Gajewski, #939)
|
275
|
+
|
276
|
+
### 3.5.0 / 2016-07-01
|
277
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0.beta4...v3.5.0)
|
278
|
+
|
279
|
+
Enhancements:
|
280
|
+
|
281
|
+
* Add support for keyword arguments to the `respond_to` matcher. (Rob Smith, #915).
|
282
|
+
|
283
|
+
### 3.5.0.beta4 / 2016-06-05
|
284
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0.beta3...v3.5.0.beta4)
|
285
|
+
|
286
|
+
Bug Fixes:
|
287
|
+
|
288
|
+
* Fix `include` matcher so that it provides a valid diff for hashes. (Yuji Nakayama, #916)
|
289
|
+
|
290
|
+
### 3.5.0.beta3 / 2016-04-02
|
291
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0.beta2...v3.5.0.beta3)
|
292
|
+
|
293
|
+
Enhancements:
|
294
|
+
|
295
|
+
* Make `rspec/expectations/minitest_integration` work on Minitest::Spec
|
296
|
+
5.6+. (Myron Marston, #904)
|
297
|
+
* Add an alias `having_attributes` for `have_attributes` matcher.
|
298
|
+
(Yuji Nakayama, #905)
|
299
|
+
* Improve `change` matcher error message when block is mis-used.
|
300
|
+
(Alex Altair, #908)
|
301
|
+
|
302
|
+
### 3.5.0.beta2 / 2016-03-10
|
303
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0.beta1...v3.5.0.beta2)
|
304
|
+
|
305
|
+
Enhancements:
|
306
|
+
|
307
|
+
* Add the ability to raise an error on encountering false positives via
|
308
|
+
`RSpec::Configuration#on_potential_false_positives = :raise`. (Jon Rowe, #900)
|
309
|
+
* When using the custom matcher DSL, support new
|
310
|
+
`notify_expectation_failures: true` option for the `match` method to
|
311
|
+
allow expectation failures to be raised as normal instead of being
|
312
|
+
converted into a `false` return value for `matches?`. (Jon Rowe, #892)
|
313
|
+
|
314
|
+
Bug Fixes:
|
315
|
+
|
316
|
+
* Allow `should` deprecation check to work on `BasicObject`s. (James Coleman, #898)
|
317
|
+
|
318
|
+
### 3.5.0.beta1 / 2016-02-06
|
319
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.4.0...v3.5.0.beta1)
|
320
|
+
|
321
|
+
Enhancements:
|
322
|
+
|
323
|
+
* Make `match_when_negated` in custom matcher DSL support use of
|
324
|
+
expectations within the match logic. (Chris Arcand, #789)
|
325
|
+
|
326
|
+
Bug Fixes:
|
327
|
+
|
328
|
+
* Return `true` as expected from passing negated expectations
|
329
|
+
(such as `expect("foo").not_to eq "bar"`), so they work
|
330
|
+
properly when used within a `match` or `match_when_negated`
|
331
|
+
block. (Chris Arcand, #789)
|
332
|
+
|
333
|
+
### 3.4.0 / 2015-11-11
|
334
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.3.1...v3.4.0)
|
335
|
+
|
336
|
+
Enhancements:
|
337
|
+
|
338
|
+
* Warn when `RSpec::Matchers` is included in a superclass after it has
|
339
|
+
already been included in a subclass on MRI 1.9, since that situation
|
340
|
+
can cause uses of `super` to trigger infinite recursion. (Myron Marston, #816)
|
341
|
+
* Stop rescuing `NoMemoryError`, `SignalExcepetion`, `Interrupt` and
|
342
|
+
`SystemExit`. It is dangerous to interfere with these. (Myron Marston, #845)
|
343
|
+
* Add `#with_captures` to the match matcher which allows a user to specify expected
|
344
|
+
captures when matching a regex against a string. (Sam Phippen, #848)
|
345
|
+
* Always print compound failure messages in the multi-line form. Trying
|
346
|
+
to print it all on a single line didn't read very well. (Myron Marston, #859)
|
347
|
+
|
348
|
+
Bug Fixes:
|
349
|
+
|
350
|
+
* Fix failure message from dynamic predicate matchers when the object
|
351
|
+
does not respond to the predicate so that it is inspected rather
|
352
|
+
than relying upon its `to_s` -- that way for `nil`, `"nil"` is
|
353
|
+
printed rather than an empty string. (Myron Marston, #841)
|
354
|
+
* Fix SystemStackError raised when diffing an Enumerable object
|
355
|
+
whose `#each` includes the object itself. (Yuji Nakayama, #857)
|
356
|
+
|
357
|
+
### 3.3.1 / 2015-07-15
|
358
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.3.0...v3.3.1)
|
359
|
+
|
360
|
+
Bug Fixes:
|
361
|
+
|
362
|
+
* Fix `be >`, `be <`, etc so that it fails rather than allowing an
|
363
|
+
argument error to be raised when compared against an object of the
|
364
|
+
wrong type. This allows it to be used in composed matcher expressions
|
365
|
+
against heterogeneous objects. (Dennis Günnewig, #809)
|
366
|
+
* Fix `respond_to` to work properly on target objects
|
367
|
+
that redefine the `method` method. (unmanbearpig, #821)
|
368
|
+
|
369
|
+
### 3.3.0 / 2015-06-12
|
370
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.2.1...v3.3.0)
|
371
|
+
|
372
|
+
Enhancements:
|
373
|
+
|
374
|
+
* Expose `RSpec::Matchers::EnglishPhrasing` to make it easier to write
|
375
|
+
nice failure messages in custom matchers. (Jared Beck, #736)
|
376
|
+
* Add `RSpec::Matchers::FailMatchers`, a mixin which provides
|
377
|
+
`fail`, `fail_with` and `fail_including` matchers for use in
|
378
|
+
specifying that an expectation fails for use by
|
379
|
+
extension/plugin authors. (Charlie Rudolph, #729)
|
380
|
+
* Avoid loading `tempfile` (and its dependencies) unless
|
381
|
+
it is absolutely needed. (Myron Marston, #735)
|
382
|
+
* Improve failure output when attempting to use `be_true` or `be_false`.
|
383
|
+
(Tim Wade, #744)
|
384
|
+
* Define `RSpec::Matchers#respond_to_missing?` so that
|
385
|
+
`RSpec::Matchers#respond_to?` and `RSpec::Matchers#method` handle
|
386
|
+
dynamic predicate matchers. (Andrei Botalov, #751)
|
387
|
+
* Use custom Time/DateTime/BigDecimal formatting for all matchers
|
388
|
+
so they are consistently represented in failure messages.
|
389
|
+
(Gavin Miller, #740)
|
390
|
+
* Add configuration to turn off warnings about matcher combinations that
|
391
|
+
may cause false positives. (Jon Rowe, #768)
|
392
|
+
* Warn when using a bare `raise_error` matcher that you may be subject to
|
393
|
+
false positives. (Jon Rowe, #768)
|
394
|
+
* Warn rather than raise when using the`raise_error` matcher in negative
|
395
|
+
expectations that may be subject to false positives. (Jon Rowe, #775)
|
396
|
+
* Improve failure message for `include(a, b, c)` so that if `a` and `b`
|
397
|
+
are included the failure message only mentions `c`. (Chris Arcand, #780)
|
398
|
+
* Allow `satisfy` matcher to take an optional description argument
|
399
|
+
that will be used in the `description`, `failure_message` and
|
400
|
+
`failure_message_when_negated` in place of the undescriptive
|
401
|
+
"sastify block". (Chris Arcand, #783)
|
402
|
+
* Add new `aggregate_failures` API that allows multiple independent
|
403
|
+
expectations to all fail and be listed in the failure output, rather
|
404
|
+
than the example aborting on the first failure. (Myron Marston, #776)
|
405
|
+
* Improve `raise_error` matcher so that it can accept a matcher as a single argument
|
406
|
+
that matches the message. (Time Wade, #782)
|
407
|
+
|
408
|
+
Bug Fixes:
|
409
|
+
|
410
|
+
* Make `contain_exactly` / `match_array` work with strict test doubles
|
411
|
+
that have not defined `<=>`. (Myron Marston, #758)
|
412
|
+
* Fix `include` matcher so that it omits the diff when it would
|
413
|
+
confusingly highlight items that are actually included but are not
|
414
|
+
an exact match in a line-by-line diff. (Tim Wade, #763)
|
415
|
+
* Fix `match` matcher so that it does not blow up when matching a string
|
416
|
+
or regex against another matcher (rather than a string or regex).
|
417
|
+
(Myron Marston, #772)
|
418
|
+
* Silence whitespace-only diffs. (Myron Marston, #801)
|
419
|
+
|
420
|
+
### 3.2.1 / 2015-04-06
|
421
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.2.0...v3.2.1)
|
422
|
+
|
423
|
+
Bug Fixes:
|
424
|
+
|
425
|
+
* Prevent `Range`s from being enumerated when generating matcher
|
426
|
+
descriptions. (Jon Rowe, #755)
|
427
|
+
* Ensure exception messages are compared as strings in the `raise_error`
|
428
|
+
matcher. (Jon Rowe, #755)
|
429
|
+
|
430
|
+
### 3.2.0 / 2015-02-03
|
431
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.1.2...v3.2.0)
|
432
|
+
|
433
|
+
Enhancements:
|
434
|
+
|
435
|
+
* Add `block_arg` method to custom matcher API, which allows you to
|
436
|
+
access the block passed to a custom matcher, if there is one.
|
437
|
+
(Mike Dalton, #645)
|
438
|
+
* Provide more detail in failure message of `yield_control` matcher.
|
439
|
+
(Jon Rowe, #650)
|
440
|
+
* Add a shorthand syntax for `chain` in the matcher DSL which assigns values
|
441
|
+
for use elsewhere, for example `chain :and_smaller_than, :small_value`
|
442
|
+
creates an `attr_reader` for `small_value` (Tom Stuart, #644)
|
443
|
+
* Provide a more helpful deprecation message when using the `should` syntax.
|
444
|
+
(Elia Schito, #663)
|
445
|
+
* Provide more detail in the `have_attributes` matcher failure message.
|
446
|
+
(Jon Rowe, #668)
|
447
|
+
* Make the `have_attributes` matcher diffable.
|
448
|
+
(Jon Rowe, Alexey Fedorov, #668)
|
449
|
+
* Add `output(...).to_std(out|err)_from_any_process` as alternatives
|
450
|
+
to `output(...).to_std(out|err)`. The latter doesn't work when a sub
|
451
|
+
process writes to the named stream but is much faster.
|
452
|
+
(Alex Genco, #700)
|
453
|
+
* Improve compound matchers (created by `and` and `or`) so that diffs
|
454
|
+
are included in failures when one or more of their matchers
|
455
|
+
are diffable. (Alexey Fedorov, #713)
|
456
|
+
|
457
|
+
Bug Fixes:
|
458
|
+
|
459
|
+
* Avoid calling `private_methods` from the `be` predicate matcher on
|
460
|
+
the target object if the object publicly responds to the predicate
|
461
|
+
method. This avoids a possible error that can occur if the object
|
462
|
+
raises errors from `private_methods` (which can happen with celluloid
|
463
|
+
objects). (@chapmajs, #670)
|
464
|
+
* Make `yield_control` (with no modifier) default to
|
465
|
+
`at_least(:once)` rather than raising a confusing error
|
466
|
+
when multiple yields are encountered.
|
467
|
+
(Myron Marston, #675)
|
468
|
+
* Fix "instance variable @color not initialized" warning when using
|
469
|
+
rspec-expectations outside of an rspec-core context. (Myron Marston, #689)
|
470
|
+
* Fix `start_with` and `end_with` to work properly when checking a
|
471
|
+
string against an array of strings. (Myron Marston, #690)
|
472
|
+
* Don't use internally delegated matchers when generating descriptions
|
473
|
+
for examples without doc strings. (Myron Marston, #692)
|
474
|
+
|
475
|
+
### 3.1.2 / 2014-09-26
|
476
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.1.1...v3.1.2)
|
477
|
+
|
478
|
+
Bug Fixes:
|
479
|
+
|
480
|
+
* Fix `define_negated_matcher` so that matchers that support fluent
|
481
|
+
interfaces continue to be negated after you use the chained method.
|
482
|
+
(Myron Marston, #656)
|
483
|
+
* Fix `define_negated_matcher` so that the matchers fail with an
|
484
|
+
appropriate failure message. (Myron Marston, #659)
|
485
|
+
|
486
|
+
### 3.1.1 / 2014-09-15
|
487
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.1.0...v3.1.1)
|
488
|
+
|
489
|
+
Bug Fixes:
|
490
|
+
|
491
|
+
* Fix regression in `all` matcher in 3.1.0 that prevented it from
|
492
|
+
working on objects that are not `Enumerable` but do implement
|
493
|
+
`each_with_index` (such as an ActiveRecord proxy). (Jori Hardman, #647)
|
494
|
+
|
495
|
+
### 3.1.0 / 2014-09-04
|
496
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.4...v3.1.0)
|
497
|
+
|
498
|
+
Enhancements:
|
499
|
+
|
500
|
+
* Add `have_attributes` matcher, that passes if actual's attribute
|
501
|
+
values match the expected attributes hash:
|
502
|
+
`Person = Struct.new(:name, :age)`
|
503
|
+
`person = Person.new("Bob", 32)`
|
504
|
+
`expect(person).to have_attributes(:name => "Bob", :age => 32)`.
|
505
|
+
(Adam Farhi, #571)
|
506
|
+
* Extended compound matcher support to block matchers, for cases like:
|
507
|
+
`expect { ... }.to change { x }.to(3).and change { y }.to(4)`. (Myron
|
508
|
+
Marston, #567)
|
509
|
+
* Include chained methods in custom matcher description and failure message
|
510
|
+
when new `include_chain_clauses_in_custom_matcher_descriptions` config
|
511
|
+
option is enabled. (Dan Oved, #600)
|
512
|
+
* Add `thrice` modifier to `yield_control` matcher as a synonym for
|
513
|
+
`exactly(3).times`. (Dennis Taylor, #615)
|
514
|
+
* Add `RSpec::Matchers.define_negated_matcher`, which defines a negated
|
515
|
+
version of the named matcher. (Adam Farhi, Myron Marston, #618)
|
516
|
+
* Document and support negation of `contain_exactly`/`match_array`.
|
517
|
+
(Jon Rowe, #626).
|
518
|
+
|
519
|
+
Bug Fixes:
|
520
|
+
|
521
|
+
* Rename private `LegacyMacherAdapter` constant to `LegacyMatcherAdapter`
|
522
|
+
to fix typo. (Abdelkader Boudih, #563)
|
523
|
+
* Fix `all` matcher so that it fails properly (rather than raising a
|
524
|
+
`NoMethodError`) when matched against a non-enumerable. (Hao Su, #622)
|
525
|
+
|
1
526
|
### 3.0.4 / 2014-08-14
|
2
527
|
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.0.3...v3.0.4)
|
3
528
|
|
@@ -162,7 +687,7 @@ Enhancements:
|
|
162
687
|
* Define noun-phrase aliases for built-in matchers, which can be
|
163
688
|
used when creating composed matcher expressions that read better
|
164
689
|
and provide better failure messages. (Myron Marston)
|
165
|
-
* Add `RSpec::
|
690
|
+
* Add `RSpec::Matchers.alias_matcher` so users can define their own
|
166
691
|
matcher aliases. The `description` of the matcher will reflect the
|
167
692
|
alternate matcher name. (Myron Marston)
|
168
693
|
* Add explicit `be_between` matcher. `be_between` has worked for a
|
@@ -215,7 +740,7 @@ Breaking Changes for 3.0.0:
|
|
215
740
|
(Sam Phippen)
|
216
741
|
* Remove the deprecated `have`, `have_at_least` and `have_at_most` matchers.
|
217
742
|
You can continue using those matchers through https://github.com/rspec/rspec-collection_matchers,
|
218
|
-
or you can rewrite your expectations with something like
|
743
|
+
or you can rewrite your expectations with something like
|
219
744
|
`expect(your_object.size).to eq(num)`. (Hugo Baraúna)
|
220
745
|
* Rename `be_true` and `be_false` to `be_truthy` and `be_falsey`. (Sam Phippen)
|
221
746
|
* Make `expect { }.to_not raise_error(SomeSpecificClass, message)`,
|
@@ -336,9 +861,9 @@ Deprecations:
|
|
336
861
|
Deprecations
|
337
862
|
|
338
863
|
* Deprecate `have`, `have_at_least` and `have_at_most`. You can continue using those
|
339
|
-
|
340
|
-
|
341
|
-
|
864
|
+
matchers through https://github.com/rspec/rspec-collection_matchers, or
|
865
|
+
you can rewrite your expectations with something like
|
866
|
+
`expect(your_object.size).to eq(num)`. (Hugo Baraúna)
|
342
867
|
* Deprecate `be_xyz` predicate matcher when `xyz?` is a private method.
|
343
868
|
(Jon Rowe)
|
344
869
|
* Deprecate `be_true`/`be_false` in favour of `be_truthy`/`be_falsey`
|
data/{License.txt → LICENSE.md}
RENAMED
@@ -1,8 +1,9 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
|
+
=====================
|
2
3
|
|
3
|
-
Copyright
|
4
|
-
Copyright
|
5
|
-
Copyright
|
4
|
+
* Copyright © 2012 David Chelimsky, Myron Marston
|
5
|
+
* Copyright © 2006 David Chelimsky, The RSpec Development Team
|
6
|
+
* Copyright © 2005 Steven Baker
|
6
7
|
|
7
8
|
Permission is hereby granted, free of charge, to any person obtaining
|
8
9
|
a copy of this software and associated documentation files (the
|