From 3b6555acd4516167f5ca094eeae50bf5ffc59db9 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 12 Jan 2007 05:10:06 +0000 Subject: Fix new_record? and id rollback. Closes #6910. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5886 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/transactions_test.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'activerecord/test/transactions_test.rb') diff --git a/activerecord/test/transactions_test.rb b/activerecord/test/transactions_test.rb index ecc0da425d..3f3ee1adb7 100644 --- a/activerecord/test/transactions_test.rb +++ b/activerecord/test/transactions_test.rb @@ -133,8 +133,9 @@ class TransactionTest < Test::Unit::TestCase :content => "Have a nice day", :approved => false) new_record_snapshot = new_topic.new_record? + id_present = new_topic.has_attribute?(Topic.primary_key) id_snapshot = new_topic.id - + # Make sure the second save gets the after_create callback called. 2.times do begin @@ -146,6 +147,7 @@ class TransactionTest < Test::Unit::TestCase assert_equal "Make the transaction rollback", e.message assert_equal new_record_snapshot, new_topic.new_record?, "The topic should have its old new_record value" assert_equal id_snapshot, new_topic.id, "The topic should have its old id" + assert_equal id_present, new_topic.has_attribute?(Topic.primary_key) ensure remove_exception_raising_after_create_callback_to_topic end -- cgit v1.2.3