rspec-expectations 2.99.2 → 3.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +14 -6
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -0
- data/Changelog.md +63 -104
- data/License.txt +1 -0
- data/README.md +14 -8
- data/features/README.md +1 -2
- data/features/built_in_matchers/README.md +3 -0
- data/features/built_in_matchers/be.feature +44 -44
- data/features/built_in_matchers/be_within.feature +1 -1
- data/features/built_in_matchers/comparisons.feature +97 -0
- data/features/built_in_matchers/cover.feature +3 -3
- data/features/built_in_matchers/end_with.feature +3 -3
- data/features/built_in_matchers/equality.feature +20 -23
- data/features/built_in_matchers/exist.feature +5 -5
- data/features/built_in_matchers/expect_error.feature +14 -14
- data/features/built_in_matchers/include.feature +15 -15
- data/features/built_in_matchers/match.feature +4 -5
- data/features/built_in_matchers/match_array.feature +37 -0
- data/features/built_in_matchers/predicates.feature +30 -6
- data/features/built_in_matchers/respond_to.feature +4 -4
- data/features/built_in_matchers/satisfy.feature +2 -2
- data/features/built_in_matchers/start_with.feature +3 -3
- data/features/built_in_matchers/types.feature +6 -6
- data/features/custom_matchers/access_running_example.feature +3 -3
- data/features/custom_matchers/define_matcher.feature +6 -34
- data/features/custom_matchers/define_matcher_outside_rspec.feature +2 -2
- data/features/custom_matchers/define_matcher_with_fluent_interface.feature +1 -1
- data/features/customized_message.feature +18 -1
- data/features/diffing.feature +3 -3
- data/features/implicit_docstrings.feature +9 -9
- data/features/step_definitions/additional_cli_steps.rb +0 -10
- data/features/support/env.rb +10 -3
- data/features/test_frameworks/test_unit.feature +0 -40
- data/lib/rspec-expectations.rb +0 -5
- data/lib/rspec/expectations.rb +4 -18
- data/lib/rspec/expectations/expectation_target.rb +10 -77
- data/lib/rspec/expectations/extensions.rb +0 -1
- data/lib/rspec/expectations/handler.rb +1 -5
- data/lib/rspec/expectations/syntax.rb +25 -5
- data/lib/rspec/expectations/version.rb +1 -1
- data/lib/rspec/matchers.rb +7 -102
- data/lib/rspec/matchers/built_in/base_matcher.rb +10 -17
- data/lib/rspec/matchers/built_in/be.rb +5 -18
- data/lib/rspec/matchers/built_in/be_within.rb +2 -8
- data/lib/rspec/matchers/built_in/change.rb +1 -39
- data/lib/rspec/matchers/built_in/has.rb +7 -40
- data/lib/rspec/matchers/built_in/include.rb +1 -1
- data/lib/rspec/matchers/built_in/match_array.rb +1 -1
- data/lib/rspec/matchers/built_in/raise_error.rb +44 -23
- data/lib/rspec/matchers/built_in/respond_to.rb +1 -7
- data/lib/rspec/matchers/built_in/satisfy.rb +1 -7
- data/lib/rspec/matchers/built_in/throw_symbol.rb +2 -10
- data/lib/rspec/matchers/built_in/yield.rb +4 -25
- data/lib/rspec/matchers/compatibility.rb +2 -2
- data/lib/rspec/{expectations → matchers}/configuration.rb +9 -6
- data/lib/rspec/matchers/dsl.rb +2 -4
- data/lib/rspec/matchers/matcher.rb +163 -283
- data/lib/rspec/matchers/operator_matcher.rb +57 -71
- data/lib/rspec/matchers/pretty.rb +0 -4
- data/lib/rspec/matchers/test_unit_integration.rb +5 -22
- data/spec/rspec/expectations/expectation_target_spec.rb +0 -62
- data/spec/rspec/expectations/extensions/kernel_spec.rb +0 -4
- data/spec/rspec/expectations_spec.rb +2 -43
- data/spec/rspec/matchers/base_matcher_spec.rb +12 -27
- data/spec/rspec/matchers/be_spec.rb +2 -71
- data/spec/rspec/matchers/change_spec.rb +1 -76
- data/spec/rspec/{expectations → matchers}/configuration_spec.rb +41 -21
- data/spec/rspec/matchers/description_generation_spec.rb +2 -21
- data/spec/rspec/matchers/equal_spec.rb +0 -26
- data/spec/rspec/matchers/has_spec.rb +0 -24
- data/spec/rspec/matchers/match_array_spec.rb +0 -13
- data/spec/rspec/matchers/matcher_spec.rb +325 -279
- data/spec/rspec/matchers/matchers_spec.rb +36 -0
- data/spec/rspec/matchers/operator_matcher_spec.rb +8 -27
- data/spec/rspec/matchers/raise_error_spec.rb +65 -209
- data/spec/rspec/matchers/yield_spec.rb +32 -9
- data/spec/spec_helper.rb +21 -6
- data/spec/support/classes.rb +7 -7
- data/spec/support/in_sub_process.rb +7 -8
- data/spec/support/shared_examples.rb +0 -42
- metadata +113 -84
- metadata.gz.sig +4 -0
- data/features/built_in_matchers/have.feature +0 -109
- data/features/built_in_matchers/operators.feature +0 -227
- data/lib/rspec/expectations/caller_filter.rb +0 -60
- data/lib/rspec/expectations/deprecation.rb +0 -27
- data/lib/rspec/expectations/extensions/array.rb +0 -9
- data/lib/rspec/matchers/be_close.rb +0 -12
- data/lib/rspec/matchers/built_in/have.rb +0 -273
- data/lib/rspec/matchers/differentiate_block_method_types.rb +0 -55
- data/lib/rspec/matchers/extensions/instance_eval_with_args.rb +0 -39
- data/lib/rspec/matchers/match_aliases.rb +0 -22
- data/spec/rspec/matchers/be_close_spec.rb +0 -25
- data/spec/rspec/matchers/differentiate_block_method_types_spec.rb +0 -39
- data/spec/rspec/matchers/have_spec.rb +0 -853
- data/spec/rspec/matchers/pretty_spec.rb +0 -23
- data/spec/support/helper_methods.rb +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZTQwOGIzZDdiMmUzMGI5OWQ2NmQzOTBjYmJiZTUzODkyYTAxOGM2YQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YzI4OTM1NjI1ZDRiZTRkYjY3NTJkMTMzMThkMWY3OTY2OWE2MDFiNQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ODFmYzI4Mjk1MTVmMjYyMjc0NzBiNTE4YTc2MjE2ZjZiMDhhODBlN2Q3ZmZm
|
10
|
+
MWFmMzU4NTkxOWZiMTczYzgzMWI5NzU5MTM5M2IyYjBkYmUxNGQ5ZDM0YjVm
|
11
|
+
MGJjMWY1ODY4MjU5ZDZmODdmOTY4MzZkMDEzNmI5Y2I5YjljNzM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MjA3YWZlNjdmOTA4YzRhYmVjODQ5MDUzMzIxNTJhMTFmMmQwZTk1MTQ3OGM2
|
14
|
+
OTNmYjI1NjhlZDMxNDU0NTlhNjljNWQ2ZWE4MTI3YWQzYjA3N2JmZmViNmY1
|
15
|
+
MThhZWNkNzZmOGJmY2M3MDBjNDQzMjJmOTkwZDAyZTlhZDJkMjc=
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
data/Changelog.md
CHANGED
@@ -1,83 +1,50 @@
|
|
1
|
-
###
|
2
|
-
[
|
1
|
+
### 3.0.0.beta1 / 2013-11-07
|
2
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.99.0.beta1...v3.0.0.beta1)
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
* Fix regression in `Expectations#method_handle_for` where proxy objects
|
7
|
-
with method delegated would wrongly not return a method handle.
|
8
|
-
(Jon Rowe, #594)
|
9
|
-
* Fix issue with detection of generic operator matchers so they work
|
10
|
-
correctly when undefined. (Myron Marston, #597)
|
11
|
-
|
12
|
-
### 2.99.1 / 2014-06-19
|
13
|
-
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.99.0...v2.99.1)
|
14
|
-
|
15
|
-
Bug Fixes:
|
4
|
+
Breaking Changes for 3.0.0:
|
16
5
|
|
17
|
-
*
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
6
|
+
* Remove explicit support for 1.8.6. (Jon Rowe)
|
7
|
+
* Remove the deprecated `be_close` matcher, preferring `be_within` instead.
|
8
|
+
(Sam Phippen)
|
9
|
+
* Rename `be_true` and `be_false` to `be_truthy` and `be_falsey`. (Sam Phippen)
|
10
|
+
* Make `expect { }.to_not raise_error(SomeSpecificClass, message)`,
|
11
|
+
`expect { }.to_not raise_error(SomeSpecificClass)` and
|
12
|
+
`expect { }.to_not raise_error(message)` invalid, since they are prone
|
13
|
+
to hiding failures. Instead, use `expect { }.to_not raise_error` (with no
|
14
|
+
args). (Sam Phippen)
|
15
|
+
* Within `RSpec::Matchers.define` blocks, helper methods made available
|
16
|
+
either via `def self.helper` or `extend HelperModule` are no longer
|
17
|
+
available to the `match` block (or any of the others). Instead
|
18
|
+
`include` your helper module and define the helper method as an
|
19
|
+
instance method. (Myron Marston)
|
22
20
|
|
23
21
|
Enhancements:
|
24
22
|
|
25
|
-
*
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
23
|
+
* Support `do..end` style block with `raise_error` matcher. (Yuji Nakayama)
|
24
|
+
* Rewrote custom matcher DSL to simplify its implementation and solve a
|
25
|
+
few issues. (Myron Marston)
|
26
|
+
* Allow early `return` from within custom matcher DSL blocks. (Myron
|
27
|
+
Marston)
|
28
|
+
* The custom matcher DSL's `chain` can now accept a block. (Myron
|
29
|
+
Marston)
|
30
|
+
* Support setting an expectation on a `raise_error` matcher via a chained
|
31
|
+
`with_message` method call. (Sam Phippen)
|
32
32
|
|
33
|
-
|
34
|
-
custom matchers. (Myron Marston)
|
35
|
-
* Deprecate `RSpec::Matchers::Pretty#_pretty_print`. (Myron Marston)
|
36
|
-
* Deprecate `RSpec::Matchers::Pretty#expected_to_sentence`. (Myron Marston)
|
37
|
-
* Deprecate `RSpec::Matchers::Configuration` in favor of
|
38
|
-
`RSpec::Expectations::Configuration`. (Myron Marston)
|
39
|
-
* Deprecate `be_xyz` predicate matcher on an object that doesn't respond to
|
40
|
-
`xyz?` or `xyzs?`. (Daniel Fone)
|
41
|
-
* Deprecate `have_xyz` matcher on an object that doesn't respond to `has_xyz?`.
|
42
|
-
(Daniel Fone)
|
43
|
-
* Deprecate `have_xyz` matcher on an object that has a private method `has_xyz?`.
|
44
|
-
(Jon Rowe)
|
45
|
-
* Issue a deprecation warning when a block expectation expression is
|
46
|
-
used with a matcher that doesn't explicitly support block expectations
|
47
|
-
via `supports_block_expectations?`. (Myron Marston)
|
48
|
-
* Deprecate `require 'rspec-expectations'`. Use
|
49
|
-
`require 'rspec/expectations'` instead. (Myron Marston)
|
33
|
+
Bug Fixes:
|
50
34
|
|
51
|
-
|
52
|
-
|
35
|
+
* Allow `include` and `match` matchers to be used from within a
|
36
|
+
DSL-defined custom matcher's `match` block. (Myron Marston)
|
53
37
|
|
54
38
|
Deprecations:
|
55
39
|
|
56
|
-
*
|
57
|
-
|
58
|
-
|
59
|
-
errors in RSpec 3. (Myron Marston)
|
60
|
-
* Change the semantics of `expect { }.not_to change { x }.from(y)`.
|
61
|
-
In RSpec 2.x, this expectation would only fail if `x` started with
|
62
|
-
the value of `y` and changed. If it started with a different value
|
63
|
-
and changed, it would pass. In RSpec 3, it will pass only if the
|
64
|
-
value starts at `y` and it does not change. (Myron Marston)
|
65
|
-
* Deprecate `matcher == value` as an alias for `matcher.matches?(value)`,
|
66
|
-
in favor of `matcher === value`. (Myron Marston)
|
67
|
-
* Deprecate `RSpec::Matchers::OperatorMatcher` in favor of
|
68
|
-
`RSpec::Matchers::BuiltIn::OperatorMatcher`. (Myron Marston)
|
69
|
-
* Deprecate auto-integration with Test::Unit and minitest.
|
70
|
-
Instead, include `RSpec::Matchers` in the appropriate test case
|
71
|
-
base class yourself. (Myron Marston)
|
72
|
-
* Deprecate treating `#expected` on a DSL-generated custom matcher
|
73
|
-
as an array when only 1 argument is passed to the matcher method.
|
74
|
-
In RSpec 3 it will be the single value in order to make diffs
|
75
|
-
work properly. (Jon Rowe)
|
40
|
+
* Using the old `:should` syntax without explicitly configuring it is deprecated.
|
41
|
+
It will continue to work but will emit a deprecation warning in RSpec 3 if
|
42
|
+
you do not explicitly enable it. (Sam Phippen)
|
76
43
|
|
77
44
|
### 2.99.0.beta1 / 2013-11-07
|
78
|
-
[
|
45
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.4...v2.99.0.beta1)
|
79
46
|
|
80
|
-
Deprecations
|
47
|
+
Deprecations
|
81
48
|
|
82
49
|
* Deprecate `have`, `have_at_least` and `have_at_most`. You can continue using those
|
83
50
|
matchers through https://github.com/rspec/rspec-collection_matchers, or
|
@@ -99,16 +66,8 @@ Deprecations:
|
|
99
66
|
* RSpec 2.x allowed helper methods defined either way to be used for
|
100
67
|
either purpose, but RSpec 3.0 will not.
|
101
68
|
|
102
|
-
### 2.14.5 / 2014-02-01
|
103
|
-
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.4...v2.14.5)
|
104
|
-
|
105
|
-
Bug fixes
|
106
|
-
|
107
|
-
* Fix wrong matcher descriptions with falsey expected value
|
108
|
-
(yujinakayama)
|
109
|
-
|
110
69
|
### 2.14.4 / 2013-11-06
|
111
|
-
[
|
70
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.3...v2.14.4)
|
112
71
|
|
113
72
|
Bug fixes
|
114
73
|
|
@@ -117,7 +76,7 @@ Bug fixes
|
|
117
76
|
back to default internal encoding with replacing characters. (Jon Rowe)
|
118
77
|
|
119
78
|
### 2.14.3 / 2013-09-22
|
120
|
-
[
|
79
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.2...v2.14.3)
|
121
80
|
|
122
81
|
Bug fixes
|
123
82
|
|
@@ -128,7 +87,7 @@ Bug fixes
|
|
128
87
|
`method_missing` (Jon Rowe)
|
129
88
|
|
130
89
|
### 2.14.2 / 2013-08-14
|
131
|
-
[
|
90
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.1...v2.14.2)
|
132
91
|
|
133
92
|
Bug fixes
|
134
93
|
|
@@ -144,7 +103,7 @@ Bug fixes
|
|
144
103
|
`SomeClass === SomeClass` returns false. (Myron Marston)
|
145
104
|
|
146
105
|
### 2.14.1 / 2013-08-08
|
147
|
-
[
|
106
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.0...2.14.1)
|
148
107
|
|
149
108
|
Bug fixes
|
150
109
|
|
@@ -153,7 +112,7 @@ Bug fixes
|
|
153
112
|
errors (Jon Rowe).
|
154
113
|
|
155
114
|
### 2.14.0 / 2013-07-06
|
156
|
-
[
|
115
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.0.rc1...v2.14.0)
|
157
116
|
|
158
117
|
Bug fixes
|
159
118
|
|
@@ -165,7 +124,7 @@ Bug fixes
|
|
165
124
|
change...` (Sam Phippen).
|
166
125
|
|
167
126
|
### 2.14.0.rc1 / 2013-05-27
|
168
|
-
[
|
127
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.13.0...v2.14.0.rc1)
|
169
128
|
|
170
129
|
Enhancements
|
171
130
|
|
@@ -199,7 +158,7 @@ Deprecations
|
|
199
158
|
error_ to pass. (Sam Phippen and David Chelimsky)
|
200
159
|
|
201
160
|
### 2.13.0 / 2013-02-23
|
202
|
-
[
|
161
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.12.1...v2.13.0)
|
203
162
|
|
204
163
|
Enhancements
|
205
164
|
|
@@ -230,7 +189,7 @@ Bug fixes
|
|
230
189
|
printed for empty diffs (Myron Marston).
|
231
190
|
|
232
191
|
### 2.12.1 / 2012-12-15
|
233
|
-
[
|
192
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.12.0...v2.12.1)
|
234
193
|
|
235
194
|
Bug fixes
|
236
195
|
|
@@ -242,7 +201,7 @@ Bug fixes
|
|
242
201
|
(Steven Harman)
|
243
202
|
|
244
203
|
### 2.12.0 / 2012-11-12
|
245
|
-
[
|
204
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.3...v2.12.0)
|
246
205
|
|
247
206
|
Enhancements
|
248
207
|
|
@@ -265,7 +224,7 @@ Bug fixes
|
|
265
224
|
(Tom Stuart)
|
266
225
|
|
267
226
|
### 2.11.3 / 2012-09-04
|
268
|
-
[
|
227
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.2...v2.11.3)
|
269
228
|
|
270
229
|
Bug fixes
|
271
230
|
|
@@ -281,7 +240,7 @@ Bug fixes
|
|
281
240
|
}.to change { user.last_emailed_at }.to be_within(1.second).of(Time.zone.now)
|
282
241
|
|
283
242
|
### 2.11.2 / 2012-07-25
|
284
|
-
[
|
243
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.1...v2.11.2)
|
285
244
|
|
286
245
|
Bug fixes
|
287
246
|
|
@@ -290,7 +249,7 @@ Bug fixes
|
|
290
249
|
of the object hierarchy. (Gabriel Gilder)
|
291
250
|
|
292
251
|
### 2.11.1 / 2012-07-08
|
293
|
-
[
|
252
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.0...v2.11.1)
|
294
253
|
|
295
254
|
Bug fixes
|
296
255
|
|
@@ -299,7 +258,7 @@ Bug fixes
|
|
299
258
|
* `Time`, for example, is a legit alternative.
|
300
259
|
|
301
260
|
### 2.11.0 / 2012-07-07
|
302
|
-
[
|
261
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.10.0...v2.11.0)
|
303
262
|
|
304
263
|
Enhancements
|
305
264
|
|
@@ -322,7 +281,7 @@ Bug fixes
|
|
322
281
|
Marston)
|
323
282
|
|
324
283
|
### 2.10.0 / 2012-05-03
|
325
|
-
[
|
284
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.9.1...v2.10.0)
|
326
285
|
|
327
286
|
Enhancements
|
328
287
|
|
@@ -340,7 +299,7 @@ Bug fixes
|
|
340
299
|
* Fix message-specific specs to pass on Rubinius (John Firebaugh)
|
341
300
|
|
342
301
|
### 2.9.1 / 2012-04-03
|
343
|
-
[
|
302
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.9.0...v2.9.1)
|
344
303
|
|
345
304
|
Bug fixes
|
346
305
|
|
@@ -351,7 +310,7 @@ Bug fixes
|
|
351
310
|
* Fix using execution context methods in nested DSL matchers (mirasrael)
|
352
311
|
|
353
312
|
### 2.9.0 / 2012-03-17
|
354
|
-
[
|
313
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0...v2.9.0)
|
355
314
|
|
356
315
|
Enhancements
|
357
316
|
|
@@ -371,7 +330,7 @@ Bug fixes
|
|
371
330
|
|
372
331
|
### 2.8.0 / 2012-01-04
|
373
332
|
|
374
|
-
[
|
333
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0.rc2...v2.8.0)
|
375
334
|
|
376
335
|
Enhancements
|
377
336
|
|
@@ -380,13 +339,13 @@ Enhancements
|
|
380
339
|
|
381
340
|
### 2.8.0.rc2 / 2011-12-19
|
382
341
|
|
383
|
-
[
|
342
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0.rc1...v2.8.0.rc2)
|
384
343
|
|
385
344
|
No changes for this release. Just releasing with the other rspec gems.
|
386
345
|
|
387
346
|
### 2.8.0.rc1 / 2011-11-06
|
388
347
|
|
389
|
-
[
|
348
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.7.0...v2.8.0.rc1)
|
390
349
|
|
391
350
|
Enhancements
|
392
351
|
|
@@ -395,7 +354,7 @@ Enhancements
|
|
395
354
|
|
396
355
|
### 2.7.0 / 2011-10-16
|
397
356
|
|
398
|
-
[
|
357
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.6.0...v2.7.0)
|
399
358
|
|
400
359
|
Enhancements
|
401
360
|
|
@@ -413,7 +372,7 @@ Bug fixes
|
|
413
372
|
|
414
373
|
### 2.6.0 / 2011-05-12
|
415
374
|
|
416
|
-
[
|
375
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.5.0...v2.6.0)
|
417
376
|
|
418
377
|
Enhancements
|
419
378
|
|
@@ -431,7 +390,7 @@ Bug fixes
|
|
431
390
|
|
432
391
|
### 2.5.0 / 2011-02-05
|
433
392
|
|
434
|
-
[
|
393
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.4.0...v2.5.0)
|
435
394
|
|
436
395
|
Enhancements
|
437
396
|
|
@@ -444,7 +403,7 @@ Documentation
|
|
444
403
|
|
445
404
|
### 2.4.0 / 2011-01-02
|
446
405
|
|
447
|
-
[
|
406
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.3.0...v2.4.0)
|
448
407
|
|
449
408
|
No functional changes in this release, which was made to align with the
|
450
409
|
rspec-core-2.4.0 release.
|
@@ -455,7 +414,7 @@ Enhancements
|
|
455
414
|
|
456
415
|
### 2.3.0 / 2010-12-12
|
457
416
|
|
458
|
-
[
|
417
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.2.1...v2.3.0)
|
459
418
|
|
460
419
|
Enhancements
|
461
420
|
|
@@ -463,11 +422,11 @@ Enhancements
|
|
463
422
|
|
464
423
|
### 2.2.0 / 2010-11-28
|
465
424
|
|
466
|
-
[
|
425
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.1.0...v2.2.0)
|
467
426
|
|
468
427
|
### 2.1.0 / 2010-11-07
|
469
428
|
|
470
|
-
[
|
429
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.1...v2.1.0)
|
471
430
|
|
472
431
|
Enhancements
|
473
432
|
|
@@ -486,7 +445,7 @@ Bug fixes
|
|
486
445
|
|
487
446
|
### 2.0.0 / 2010-10-10
|
488
447
|
|
489
|
-
[
|
448
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.rc...v2.0.0)
|
490
449
|
|
491
450
|
Enhancements
|
492
451
|
|
@@ -501,7 +460,7 @@ Bug fixes
|
|
501
460
|
|
502
461
|
### 2.0.0.rc / 2010-10-05
|
503
462
|
|
504
|
-
[
|
463
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.beta.22...v2.0.0.rc)
|
505
464
|
|
506
465
|
Enhancements
|
507
466
|
|
@@ -514,7 +473,7 @@ Bug fixes
|
|
514
473
|
|
515
474
|
### 2.0.0.beta.22 / 2010-09-12
|
516
475
|
|
517
|
-
[
|
476
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.beta.20...v2.0.0.beta.22)
|
518
477
|
|
519
478
|
Enhancements
|
520
479
|
|
data/License.txt
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# RSpec Expectations [![Build Status](https://secure.travis-ci.org/rspec/rspec-expectations.png?branch=master)](http://travis-ci.org/rspec/rspec-expectations) [![Code Climate](https://codeclimate.com/github/rspec/rspec-expectations.png)](https://codeclimate.com/github/rspec/rspec-expectations)
|
1
|
+
# RSpec Expectations [![Build Status](https://secure.travis-ci.org/rspec/rspec-expectations.png?branch=master)](http://travis-ci.org/rspec/rspec-expectations) [![Code Climate](https://codeclimate.com/github/rspec/rspec-expectations.png)](https://codeclimate.com/github/rspec/rspec-expectations) [![Coverage Status](https://coveralls.io/repos/rspec/rspec-expectations/badge.png?branch=master)](https://coveralls.io/r/rspec/rspec-expectations?branch=master)
|
2
2
|
|
3
3
|
RSpec::Expectations lets you express expected outcomes on an object in an
|
4
4
|
example.
|
@@ -54,7 +54,7 @@ expect(actual).to eq(expected) # passes if actual == expected
|
|
54
54
|
expect(actual).to eql(expected) # passes if actual.eql?(expected)
|
55
55
|
```
|
56
56
|
|
57
|
-
Note: The new `expect` syntax no longer supports `==` matcher.
|
57
|
+
Note: The new `expect` syntax no longer supports the `==` matcher.
|
58
58
|
|
59
59
|
### Identity
|
60
60
|
|
@@ -71,6 +71,7 @@ expect(actual).to be >= expected
|
|
71
71
|
expect(actual).to be <= expected
|
72
72
|
expect(actual).to be < expected
|
73
73
|
expect(actual).to be_within(delta).of(expected)
|
74
|
+
expect(array).to match_array(expected)
|
74
75
|
```
|
75
76
|
|
76
77
|
### Regular expressions
|
@@ -79,21 +80,25 @@ expect(actual).to be_within(delta).of(expected)
|
|
79
80
|
expect(actual).to match(/expression/)
|
80
81
|
```
|
81
82
|
|
82
|
-
Note: The new `expect` syntax no longer supports `=~` matcher.
|
83
|
+
Note: The new `expect` syntax no longer supports the `=~` matcher.
|
83
84
|
|
84
85
|
### Types/classes
|
85
86
|
|
86
87
|
```ruby
|
87
|
-
expect(actual).to be_an_instance_of(expected)
|
88
|
-
expect(actual).to
|
88
|
+
expect(actual).to be_an_instance_of(expected) # passes if actual.class == expected
|
89
|
+
expect(actual).to be_a(expected) # passes if actual.is_a?(expected)
|
90
|
+
expect(actual).to be_an(expected) # an alias for be_a
|
91
|
+
expect(actual).to be_a_kind_of(expected) # another alias
|
89
92
|
```
|
90
93
|
|
91
94
|
### Truthiness
|
92
95
|
|
93
96
|
```ruby
|
94
|
-
expect(actual).to
|
95
|
-
expect(actual).to
|
96
|
-
expect(actual).to
|
97
|
+
expect(actual).to be_truthy # passes if actual is truthy (not nil or false)
|
98
|
+
expect(actual).to be true # passes if actual == true
|
99
|
+
expect(actual).to be_falsy # passes if actual is falsy (nil or false)
|
100
|
+
expect(actual).to be false # passes if actual == false
|
101
|
+
expect(actual).to be_nil # passes if actual is nil
|
97
102
|
```
|
98
103
|
|
99
104
|
### Expecting errors
|
@@ -182,3 +187,4 @@ See [detailed information on the `should` syntax and its usage.](https://github.
|
|
182
187
|
* [http://github.com/rspec/rspec](http://github.com/rspec/rspec)
|
183
188
|
* [http://github.com/rspec/rspec-core](http://github.com/rspec/rspec-core)
|
184
189
|
* [http://github.com/rspec/rspec-mocks](http://github.com/rspec/rspec-mocks)
|
190
|
+
* [http://github.com/rspec/rspec-collection_matchers](https://github.com/rspec/rspec-collection_matchers)
|