diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-10-22 16:48:09 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-10-22 16:55:57 -0700 |
commit | f7c2a8114136dd872e9d81aa16e93b9b9a148b0b (patch) | |
tree | 0b0ccae425696e0a0ed208aecf9ede7fd35d206a /activerecord/test/cases/transactions_test.rb | |
parent | 247127193794fb239e23b544297accf63b7ad4fc (diff) | |
download | rails-f7c2a8114136dd872e9d81aa16e93b9b9a148b0b.tar.gz rails-f7c2a8114136dd872e9d81aa16e93b9b9a148b0b.tar.bz2 rails-f7c2a8114136dd872e9d81aa16e93b9b9a148b0b.zip |
frozen state should be restored after txn is aborted
Diffstat (limited to 'activerecord/test/cases/transactions_test.rb')
-rw-r--r-- | activerecord/test/cases/transactions_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index c2fc239167..45b1c66544 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -14,6 +14,21 @@ class TransactionTest < ActiveRecord::TestCase @first, @second = Topic.find(1, 2).sort_by { |t| t.id } end + def test_raise_after_destroy + assert !@first.frozen? + + assert_raises(RuntimeError) { + Topic.transaction do + @first.destroy + assert @first.frozen? + raise + end + } + + assert @first.reload + assert !@first.frozen? + end + def test_successful Topic.transaction do @first.approved = true |