diff options
author | Arthur Neves <arthurnn@gmail.com> | 2014-05-07 16:02:22 -0400 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-07 17:39:24 -0300 |
commit | 37c238927fbed059de3f26a90d8923fb377568a5 (patch) | |
tree | 442bcf6ce4f31d2527ae3851e1345b7a6e28fc07 /activerecord/test/cases | |
parent | 8d8d4f1560264cd1c74364d67fa0501f6dd2c4fa (diff) | |
download | rails-37c238927fbed059de3f26a90d8923fb377568a5.tar.gz rails-37c238927fbed059de3f26a90d8923fb377568a5.tar.bz2 rails-37c238927fbed059de3f26a90d8923fb377568a5.zip |
Keep track of dirty attrs after after rollback.
[related #13166]
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/transactions_test.rb | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index bb5548a60f..7f2e830083 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -274,7 +274,7 @@ class TransactionTest < ActiveRecord::TestCase end end - def test_dirty_state_rollback + def test_rollback_when_changing_inside_transaction assert !@first.approved? Topic.transaction do @first.approved = true @@ -287,7 +287,7 @@ class TransactionTest < ActiveRecord::TestCase assert @first.reload.approved end - def test_dirty_state_rollback2 + def test_rollback_when_changing_outside_transaction assert !@first.approved? @first.approved = true Topic.transaction do @@ -300,22 +300,7 @@ class TransactionTest < ActiveRecord::TestCase assert @first.reload.approved end - def test_dirty_state_rollback3 - assert !@first.approved? - @first.approved = true - @first.save! - Topic.transaction do - @first.approved = false - @first.save! - raise ActiveRecord::Rollback - end - assert !@first.approved - assert @first.changes["approved"] - @first.save! - assert !@first.reload.approved - end - - def test_dirty_state_rollback4 + def test_rollback_when_changing_back_to_prev_stage assert !@first.approved? Topic.transaction do @first.approved = true @@ -330,6 +315,7 @@ class TransactionTest < ActiveRecord::TestCase assert !@first.reload.approved end + def test_force_savepoint_in_nested_transaction Topic.transaction do @first.approved = true |