From 52498c53c8f13c9eb0d74260a86583e1c668da26 Mon Sep 17 00:00:00 2001 From: Sergio Gil Date: Mon, 18 May 2009 21:50:17 +0200 Subject: [PATCH] Test reproducing bug #2298 --- activerecord/test/cases/transactions_test.rb | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index f6533b5..6144fdf 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -212,6 +212,15 @@ class TransactionTest < ActiveRecord::TestCase assert !Topic.find(1).approved?, "First shouldn't have been approved" assert Topic.find(2).approved?, "Second should still be approved" end + + def test_id_not_set_after_rolling_back + Topic.transaction do + @topic = Topic.create + raise ActiveRecord::Rollback + end + assert @topic.new_record? + assert_nil @topic.id + end def test_invalid_keys_for_transaction assert_raise ArgumentError do -- 1.6.0.4