features/built_in_matchers/README.md in rspec-expectations-3.0.0.beta1 vs features/built_in_matchers/README.md in rspec-expectations-3.0.0.beta2
- old
+ new
@@ -44,14 +44,15 @@
expect(actual).to be_instance_of(expected)
expect(actual).to be_kind_of(expected)
## Truthiness and existentialism
- expect(actual).to be_true # passes if actual is truthy (not nil or false)
- expect(actual).to be_false # passes if actual is falsy (nil or false)
- expect(actual).to be_nil # passes if actual is nil
- expect(actual).to be # passes if actual is truthy (not nil or false)
+ expect(actual).to be_truthy # passes if actual is truthy (not nil or false)
+ expect(actual).to be true # passes if actual == true
+ expect(actual).to be_falsey # passes if actual is falsy (nil or false)
+ expect(actual).to be false # passes if actual == false
+ expect(actual).to be_nil # passes if actual is nil
## Expecting errors
expect { ... }.to raise_error
expect { ... }.to raise_error(ErrorClass)
@@ -75,19 +76,21 @@
expect(:a => 1).to have_key(:a)
## Collection membership
expect(actual).to include(expected)
- expect(array).to match_array(expected)
+ expect(array).to match_array(expected_array)
+ # ...which is the same as:
+ expect(array).to contain_exactly(individual, elements)
### Examples
- expect([1,2,3]).to include(1)
- expect([1,2,3]).to include(1, 2)
+ expect([1, 2, 3]).to include(1)
+ expect([1, 2, 3]).to include(1, 2)
expect(:a => 'b').to include(:a => 'b')
expect("this string").to include("is str")
- expect([1,2,3]).to match_array([1,2,3])
- expect([1,2,3]).to match_array([3,2,1])
+ expect([1, 2, 3]).to contain_exactly(2, 1, 3)
+ expect([1, 2, 3]).to match_array([3, 2, 1])
## Ranges (1.9 only)
expect(1..10).to cover(3)