Created
April 18, 2009 23:08
-
-
Save zdennis/97819 to your computer and use it in GitHub Desktop.
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
class Item < ActiveRecord::Base | |
def self.make_three_with_transactions | |
transaction do | |
transaction do | |
Item.create! | |
Item.create! | |
Item.create! | |
end | |
end | |
end | |
end |
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 File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | |
describe Item do | |
it "should have 3 records" do | |
Item.make_three_with_transactions | |
Item.count.should == 3 | |
end | |
it "should have 0 records" do | |
Item.count.should == 0 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment