From 1b2941cba1165b0721f57524645fe378bee2a950 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 8 Jun 2010 14:40:20 -0400 Subject: Temporarily revert "Update after_commit and after_rollback docs and tests to use new style API with an :on options instead of on_* suffix." and "Add after_commit and after_rollback callbacks to ActiveRecord that are called after transactions either commit or rollback on all records saved or destroyed in the transaction." This reverts commits d2a49e4b1f30c5997e169110eed94a55aee53f56 and da840d13da865331297d5287391231b1ed39721b. [#2991] Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/transactions.rb activerecord/test/cases/transaction_callbacks_test.rb --- activerecord/test/cases/transactions_test.rb | 33 ---------------------------- 1 file changed, 33 deletions(-) (limited to 'activerecord/test/cases/transactions_test.rb') diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index 958a4e4f94..00f3b527d7 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -320,33 +320,6 @@ class TransactionTest < ActiveRecord::TestCase end end - def test_restore_active_record_state_for_all_records_in_a_transaction - topic_1 = Topic.new(:title => 'test_1') - topic_2 = Topic.new(:title => 'test_2') - Topic.transaction do - assert topic_1.save - assert topic_2.save - @first.save - @second.destroy - assert_equal false, topic_1.new_record? - assert_not_nil topic_1.id - assert_equal false, topic_2.new_record? - assert_not_nil topic_2.id - assert_equal false, @first.new_record? - assert_not_nil @first.id - assert_equal true, @second.destroyed? - raise ActiveRecord::Rollback - end - - assert_equal true, topic_1.new_record? - assert_nil topic_1.id - assert_equal true, topic_2.new_record? - assert_nil topic_2.id - assert_equal false, @first.new_record? - assert_not_nil @first.id - assert_equal false, @second.destroyed? - end - if current_adapter?(:PostgreSQLAdapter) && defined?(PGconn::PQTRANS_IDLE) def test_outside_transaction_works assert Topic.connection.outside_transaction? @@ -409,12 +382,6 @@ class TransactionTest < ActiveRecord::TestCase end private - def define_callback_method(callback_method) - define_method(callback_method) do - self.history << [callback_method, :method] - end - end - def add_exception_raising_after_save_callback_to_topic Topic.class_eval <<-eoruby, __FILE__, __LINE__ + 1 remove_method(:after_save_for_transaction) -- cgit v1.2.3