Created
August 16, 2011 21:38
-
-
Save emschwar/1150242 to your computer and use it in GitHub Desktop.
Transactions across before :all with rspec2
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
require 'spec_helper' | |
describe "transactions" do | |
before :all do | |
@device = Factory(:device) | |
end | |
it "has one device before a nested context" do | |
Device.count.should == 1 | |
end | |
describe "in a nested context" do | |
before :all do | |
@device2 = Factory(:device) | |
end | |
it "has two devices" do | |
Device.count.should == 2 | |
end | |
end | |
describe "in another nested context" do | |
before :all do | |
@device2 = Factory(:device) | |
end | |
it "has two devices" do | |
Device.count.should == 2 | |
end | |
end | |
it "has one device after a nested context" do | |
Device.count.should == 1 | |
end | |
end | |
describe "another top-level example group" do | |
it "has no devices" do | |
Device.count.should == 0 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment