diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-05-22 12:15:06 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-05-22 12:15:06 -0700 |
commit | 9ee85281bca899fc521200a087149d7c8c3940d9 (patch) | |
tree | 8f9f727fc2ffd24c9cd46e858343f5bed6b9d16c /activerecord/test | |
parent | 56b86a377a9fa7d63a6fce1e5801c4910dfc703e (diff) | |
parent | a5430024fd7e654d379b20373247033f68ec0a21 (diff) | |
download | rails-9ee85281bca899fc521200a087149d7c8c3940d9.tar.gz rails-9ee85281bca899fc521200a087149d7c8c3940d9.tar.bz2 rails-9ee85281bca899fc521200a087149d7c8c3940d9.zip |
Merge pull request #6445 from chancancode/3-2-stable_restore_frozen_state_on_rollback
Restore the frozen state on rollback. (Backports #6420)
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/transactions_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index 203dd054f1..a9ccd00fac 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -362,6 +362,16 @@ class TransactionTest < ActiveRecord::TestCase end end + def test_rollback_when_saving_a_frozen_record + topic = Topic.new(:title => 'test') + topic.freeze + e = assert_raise(RuntimeError) { topic.save } + assert_equal "can't modify frozen Hash", e.message + assert !topic.persisted?, 'not persisted' + assert_nil topic.id + assert topic.frozen?, 'not frozen' + end + def test_restore_active_record_state_for_all_records_in_a_transaction topic_1 = Topic.new(:title => 'test_1') topic_2 = Topic.new(:title => 'test_2') |