diff options
author | wangjohn <wangjohn@mit.edu> | 2013-01-20 13:19:05 -0500 |
---|---|---|
committer | wangjohn <wangjohn@mit.edu> | 2013-01-21 12:16:55 -0500 |
commit | 26853e8948167b7388244ef67f0480211ad2d9f5 (patch) | |
tree | b7e42d4727305d51c4a5dc5e2bfaf83fb42b5137 /activerecord/test | |
parent | 4e327225947b933d5434509e02e98226c581adc1 (diff) | |
download | rails-26853e8948167b7388244ef67f0480211ad2d9f5.tar.gz rails-26853e8948167b7388244ef67f0480211ad2d9f5.tar.bz2 rails-26853e8948167b7388244ef67f0480211ad2d9f5.zip |
Refactored transaction state into its own object. Each transaction creates a new transaction state object upon initialization.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/transactions_test.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index 9d278480ef..546737b398 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -456,9 +456,13 @@ class TransactionTest < ActiveRecord::TestCase transaction = ActiveRecord::ConnectionAdapters::ClosedTransaction.new(connection).begin assert transaction.open? + assert !transaction.state.rolledback? + assert !transaction.state.committed? + transaction.perform_rollback - assert transaction.rolledback? + assert transaction.state.rolledback? + assert !transaction.state.committed? end def test_transactions_state_from_commit @@ -466,9 +470,13 @@ class TransactionTest < ActiveRecord::TestCase transaction = ActiveRecord::ConnectionAdapters::ClosedTransaction.new(connection).begin assert transaction.open? + assert !transaction.state.rolledback? + assert !transaction.state.committed? + transaction.perform_commit - assert transaction.committed? + assert !transaction.state.rolledback? + assert transaction.state.committed? end private |