Skip to content

Instantly share code, notes, and snippets.

@kaznum
Created September 27, 2011 01:42
Show Gist options
  • Save kaznum/1244068 to your computer and use it in GitHub Desktop.
Save kaznum/1244068 to your computer and use it in GitHub Desktop.
Which is better to write when use expect{} on rspec
# 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