diff options
author | Akira Matsuda <ronnie@dio.jp> | 2013-07-26 21:34:04 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2013-07-29 03:03:24 +0900 |
commit | f0942a7c236ba87a034f65827ddd2706c5c48ca3 (patch) | |
tree | 61073e18a29e9bb1542352ba1f29f7d20264e19e /activerecord/test | |
parent | 516606b8194f74a148e61bf7eb9693e6500aaa9c (diff) | |
download | rails-f0942a7c236ba87a034f65827ddd2706c5c48ca3.tar.gz rails-f0942a7c236ba87a034f65827ddd2706c5c48ca3.tar.bz2 rails-f0942a7c236ba87a034f65827ddd2706c5c48ca3.zip |
Don't rewrite AR connection#commit_db_transaction method globally
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/transaction_callbacks_test.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/test/cases/transaction_callbacks_test.rb b/activerecord/test/cases/transaction_callbacks_test.rb index 9485de88a6..5644a35385 100644 --- a/activerecord/test/cases/transaction_callbacks_test.rb +++ b/activerecord/test/cases/transaction_callbacks_test.rb @@ -182,9 +182,9 @@ class TransactionCallbacksTest < ActiveRecord::TestCase end def test_call_after_rollback_when_commit_fails - @first.class.connection.class.send(:alias_method, :real_method_commit_db_transaction, :commit_db_transaction) + @first.class.connection.singleton_class.send(:alias_method, :real_method_commit_db_transaction, :commit_db_transaction) begin - @first.class.connection.class.class_eval do + @first.class.connection.singleton_class.class_eval do def commit_db_transaction; raise "boom!"; end end @@ -194,8 +194,8 @@ class TransactionCallbacksTest < ActiveRecord::TestCase assert !@first.save rescue nil assert_equal [:after_rollback], @first.history ensure - @first.class.connection.class.send(:remove_method, :commit_db_transaction) - @first.class.connection.class.send(:alias_method, :commit_db_transaction, :real_method_commit_db_transaction) + @first.class.connection.singleton_class.send(:remove_method, :commit_db_transaction) + @first.class.connection.singleton_class.send(:alias_method, :commit_db_transaction, :real_method_commit_db_transaction) end end |