Created
September 27, 2011 01:42
-
-
Save kaznum/1244068 to your computer and use it in GitHub Desktop.
Which is better to write when use expect{} on rspec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I'm wondering which is better | |
# ex1: in it ".." block | |
describe "#create" do | |
it "should create an item" do | |
expect { Item.create(:name => 'foo') }.to change{Item.count}.by(1) | |
end | |
end | |
# ex2: in specify block | |
describe "#create" do | |
specify { | |
expect { Item.create(:name => 'foo') }.to change{Item.count}.by(1) | |
} | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment