diff options
author | Carl Lerche <me@carllerche.com> | 2010-10-14 21:27:40 -0700 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2010-10-14 21:27:40 -0700 |
commit | 69789c3b29b9ee0b89928f4211060f470d0e0c44 (patch) | |
tree | 00a9aeae23bdaeb9a27c89aa20be325bfb15a633 /activerecord/test | |
parent | 9ebe582830fd0386e09a917d81eb6cff494cd590 (diff) | |
download | rails-69789c3b29b9ee0b89928f4211060f470d0e0c44.tar.gz rails-69789c3b29b9ee0b89928f4211060f470d0e0c44.tar.bz2 rails-69789c3b29b9ee0b89928f4211060f470d0e0c44.zip |
#transaction on the instance level should take options as well
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/transactions_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index 8385286fd0..44af54b143 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -263,6 +263,27 @@ class TransactionTest < ActiveRecord::TestCase assert !@second.reload.approved? end if Topic.connection.supports_savepoints? + def test_force_savepoint_on_instance + @first.transaction do + @first.approved = true + @second.approved = false + @first.save! + @second.save! + + begin + @second.transaction :requires_new => true do + @first.happy = false + @first.save! + raise + end + rescue + end + end + + assert @first.reload.approved? + assert !@second.reload.approved? + end if Topic.connection.supports_savepoints? + def test_no_savepoint_in_nested_transaction_without_force Topic.transaction do @first.approved = true |