Skip to content

Instantly share code, notes, and snippets.

@zdennis
Created April 18, 2009 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zdennis/97819 to your computer and use it in GitHub Desktop.
Save zdennis/97819 to your computer and use it in GitHub Desktop.
class Item < ActiveRecord::Base
def self.make_three_with_transactions
transaction do
transaction do
Item.create!
Item.create!
Item.create!
end
end
end
end
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