Created
July 30, 2010 23:54
-
-
Save nruth/501517 to your computer and use it in GitHub Desktop.
rspec 1 before / let for context
This file contains 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
describe "3 users exist" | |
let(:users) {(1..3).map {User.make}} | |
specify "user count should be 3" do | |
pending "this will fail because users hasn't been called" do | |
User.count.should == 3 | |
end | |
end | |
specify "3 users should exist" do | |
users | |
User.count.should == 3 | |
end | |
specify "ordering matches creation" do | |
users | |
User.all.should == users | |
end | |
end | |
#vs | |
describe "3 users exist" | |
let(:users) {(1..3).map {User.make}} | |
before(:each) { users.should be_present } | |
specify "user count should be 3" do | |
User.count.should == 3 | |
end | |
specify "ordering matches creation" do | |
User.all.should == users | |
end | |
end | |
#vs | |
describe "3 users exist" | |
before(:each) { @users = (1..3).map {User.make} } | |
specify "user count should be 3" do | |
User.count.should == 3 | |
end | |
specify "ordering matches creation" do | |
User.all.should == @users | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment