diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-01-20 11:04:22 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-01-20 11:04:22 -0800 |
commit | a1c0e51a2c99ec88fba59824b59f32f0d34a0aae (patch) | |
tree | d6d4cfd43d691f13f1e8eaf1f55f835f15e4a594 /activerecord/test/cases/transactions_test.rb | |
parent | 5503796096eb0edbe1ed554a6c8d3fdc98314231 (diff) | |
parent | bbcebb6ab276c71be88c3ae0548bb7bf4e18630d (diff) | |
download | rails-a1c0e51a2c99ec88fba59824b59f32f0d34a0aae.tar.gz rails-a1c0e51a2c99ec88fba59824b59f32f0d34a0aae.tar.bz2 rails-a1c0e51a2c99ec88fba59824b59f32f0d34a0aae.zip |
Merge pull request #9006 from wangjohn/activerecord_transaction_state
Created state for a transaction and added tests.
Diffstat (limited to 'activerecord/test/cases/transactions_test.rb')
-rw-r--r-- | activerecord/test/cases/transactions_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index bcbc48b38a..9d278480ef 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -451,6 +451,26 @@ class TransactionTest < ActiveRecord::TestCase end end + def test_transactions_state_from_rollback + connection = Topic.connection + transaction = ActiveRecord::ConnectionAdapters::ClosedTransaction.new(connection).begin + + assert transaction.open? + transaction.perform_rollback + + assert transaction.rolledback? + end + + def test_transactions_state_from_commit + connection = Topic.connection + transaction = ActiveRecord::ConnectionAdapters::ClosedTransaction.new(connection).begin + + assert transaction.open? + transaction.perform_commit + + assert transaction.committed? + end + private %w(validation save destroy).each do |filter| |