Browse files

Merge pull request #224 from gautamkpai/update_docs

Update to use expect syntax.
  • Loading branch information...
2 parents cf84fea + 1e6e76d commit 138e8ad0d08ab12d1866f72da33d1c392bdf175c @myronmarston myronmarston committed Mar 17, 2013
Showing with 8 additions and 9 deletions.
  1. +8 −9 features/README.md
View
17 features/README.md
@@ -2,25 +2,24 @@ rspec-expectations is used to define expected outcomes.
describe Account do
it "has a balance of zero when first created" do
- Account.new.balance.should eq(Money.new(0))
+ expect(Account.new.balance).to eq(Money.new(0))
end
end
## Basic structure
The basic structure of an rspec expectation is:
- actual.should matcher(expected)
- actual.should_not matcher(expected)
+ expect(actual).to matcher(expected)
+ expect(actual).not_to matcher(expected)
-## `should` and `should_not`
+Note: You can also use `expect(..).to_not` instead of `expect(..).not_to`.
+ One is an alias to the other, so you can use whichever reads better to you.
-`rspec-expectations` adds `should` and `should_not` to every object in
-the system. These methods each accept a matcher as an argument. This allows
-each matcher to work in a positive or negative mode:
+#### Examples
- 5.should eq(5)
- 5.should_not eq(4)
+ expect(5).to eq(5)
+ expect(5).not_to eq(4)
## What is a matcher?

0 comments on commit 138e8ad

Please sign in to comment.