From c6fd24643604b5779a76527e6364f21ee5cc3ce0 Mon Sep 17 00:00:00 2001 From: brainopia Date: Thu, 25 Dec 2014 23:33:47 +0300 Subject: Propagate frozen state during transaction changes --- activerecord/test/cases/transactions_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index cf50bd4ddb..34afbb0a45 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -562,6 +562,20 @@ class TransactionTest < ActiveRecord::TestCase assert !@second.destroyed?, 'not destroyed' end + def test_restore_frozen_state_after_double_destroy + topic = Topic.create + reply = topic.replies.create + + Topic.transaction do + topic.destroy # calls #destroy on reply (since dependent: destroy) + reply.destroy + + raise ActiveRecord::Rollback + end + + assert !reply.frozen?, 'not frozen' + end + def test_sqlite_add_column_in_transaction return true unless current_adapter?(:SQLite3Adapter) -- cgit v1.2.3