aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorArthur Nogueira Neves <github@arthurnn.com>2015-03-07 18:56:24 -0500
committerArthur Nogueira Neves <github@arthurnn.com>2015-03-07 18:56:24 -0500
commit095f4c9da36ef7ca50d2799420f4f058afce112b (patch)
tree94bd8beddd5da2c8a8198485fbc982480aa43b0f /activerecord/test
parent96b8f401f58e9ed4ea41aa32a2b34850640ac0d7 (diff)
parentcaae79a385ce112245262a17414bcd96bea013c2 (diff)
downloadrails-095f4c9da36ef7ca50d2799420f4f058afce112b.tar.gz
rails-095f4c9da36ef7ca50d2799420f4f058afce112b.tar.bz2
rails-095f4c9da36ef7ca50d2799420f4f058afce112b.zip
Merge pull request #18200 from brainopia/rollback_frozen_records
Fix rollback of frozen records
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/transactions_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb
index 88e595c39f..4be3ea445c 100644
--- a/activerecord/test/cases/transactions_test.rb
+++ b/activerecord/test/cases/transactions_test.rb
@@ -584,6 +584,24 @@ class TransactionTest < ActiveRecord::TestCase
assert_not topic.frozen?
end
+ def test_rollback_of_frozen_records
+ topic = Topic.create.freeze
+ Topic.transaction do
+ topic.destroy
+ raise ActiveRecord::Rollback
+ end
+ 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)