aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-12-26 13:11:18 -0700
committerSean Griffin <sean@thoughtbot.com>2014-12-26 13:13:27 -0700
commitf5e6bafe6a7832ff20ebc3397e3b212ded2e6f63 (patch)
tree160c7207257aeb6fd18621551018001bbfdcab08 /activerecord/test/cases
parenta983e1e89c6f55cd08feb394db33ca0620fadfd1 (diff)
parentc6fd24643604b5779a76527e6364f21ee5cc3ce0 (diff)
downloadrails-f5e6bafe6a7832ff20ebc3397e3b212ded2e6f63.tar.gz
rails-f5e6bafe6a7832ff20ebc3397e3b212ded2e6f63.tar.bz2
rails-f5e6bafe6a7832ff20ebc3397e3b212ded2e6f63.zip
Merge branch 'brainopia-remember_frozen_state_in_transaction'
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/transactions_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb
index cf50bd4ddb..0bbb4bb79e 100644
--- a/activerecord/test/cases/transactions_test.rb
+++ b/activerecord/test/cases/transactions_test.rb
@@ -562,6 +562,21 @@ 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_not reply.frozen?
+ assert_not topic.frozen?
+ end
+
def test_sqlite_add_column_in_transaction
return true unless current_adapter?(:SQLite3Adapter)