Skip to content

Instantly share code, notes, and snippets.

@zdennis

zdennis/item.rb

Created Apr 18, 2009
Embed
What would you like to do?
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