aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorbrainopia <brainopia@evilmartians.com>2015-03-04 15:24:03 +0300
committerbrainopia <brainopia@evilmartians.com>2015-03-04 15:24:03 +0300
commitcaae79a385ce112245262a17414bcd96bea013c2 (patch)
tree3797e0efee56b7e360eca163effdd31183252b73 /activerecord/test
parent8313797810eefb7e00d0b5a8e91ac02907fa5e8f (diff)
downloadrails-caae79a385ce112245262a17414bcd96bea013c2.tar.gz
rails-caae79a385ce112245262a17414bcd96bea013c2.tar.bz2
rails-caae79a385ce112245262a17414bcd96bea013c2.zip
Fix transaction state for unsynced records when entering transaction
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/transactions_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb
index 922d01601e..4be3ea445c 100644
--- a/activerecord/test/cases/transactions_test.rb
+++ b/activerecord/test/cases/transactions_test.rb
@@ -593,6 +593,15 @@ class TransactionTest < ActiveRecord::TestCase
assert topic.frozen?, 'frozen'
end
+ def test_rollback_for_freshly_persisted_records
+ topic = Topic.create
+ Topic.transaction do
+ topic.destroy
+ raise ActiveRecord::Rollback
+ end
+ assert topic.persisted?, 'persisted'
+ end
+
def test_sqlite_add_column_in_transaction
return true unless current_adapter?(:SQLite3Adapter)