features/built_in_matchers/README.md in rspec-expectations-2.6.0 vs features/built_in_matchers/README.md in rspec-expectations-2.7.0.rc1
- old
+ new
@@ -27,14 +27,14 @@
actual.should be_instance_of(expected)
actual.should be_kind_of(expected)
## Truthiness and existentialism
- actual.should be_true # passes if actual is anything but nil or false
- actual.should be_false # passes if actual is nil or false
+ actual.should be_true # passes if actual is truthy (not nil or false)
+ actual.should be_false # passes if actual is falsy (nil or false)
actual.should be_nil # passes if actual is nil
- actual.should be # passes if actual is not nil
+ actual.should be # passes if actual is truthy (not nil or false)
## Expecting errors
expect { ... }.to raise_error
expect { ... }.to raise_error(ErrorClass)
@@ -47,14 +47,16 @@
expect { ... }.to throw_symbol(:symbol)
expect { ... }.to throw_symbol(:symbol, 'value')
## Predicate matchers
- actual.should be_xxx # passes if actual.xxx?
+ actual.should be_xxx # passes if actual.xxx?
+ actual.should have_xxx(:arg) # passes if actual.has_xxx?(:arg)
-### Example
+### Examples
[].should be_empty # passes because [].empty? returns true
+ { :a => 1 }.should have_key(:a) # passes because the hash has the key :a
## Collection membership
actual.should include(expected)