Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update to use expect syntax. #224

Merged
merged 1 commit into from

2 participants

gautamkpai Myron Marston
gautamkpai

No description provided.

Myron Marston myronmarston merged commit 138e8ad into from
Myron Marston

Thanks!

gautamkpai gautamkpai deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 17, 2013
  1. gautamkpai
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 9 deletions.
  1. +8 −9 features/README.md
17 features/README.md
View
@@ -2,7 +2,7 @@ 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
@@ -10,17 +10,16 @@ rspec-expectations is used to define expected outcomes.
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?
Something went wrong with that request. Please try again.