aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-12-26 07:16:56 -0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-12-26 07:16:56 -0800
commite72790c4e7adf5ede082f8c71304c5d9972cf7bc (patch)
treefca4bb25b7240831c1b654c6fbc45da964f63b09 /activerecord/test
parent84d38f6033a0eca73feb0eb8c43d99913b0204cb (diff)
parent5a3dc8092d19c816b0b1203945639cb91d065847 (diff)
downloadrails-e72790c4e7adf5ede082f8c71304c5d9972cf7bc.tar.gz
rails-e72790c4e7adf5ede082f8c71304c5d9972cf7bc.tar.bz2
rails-e72790c4e7adf5ede082f8c71304c5d9972cf7bc.zip
Merge pull request #5100 from paukul/validate_on_condition_on_transaction_callbacks
Validate :on option on after_commit and after_rollback callbacks
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/transaction_callbacks_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/transaction_callbacks_test.rb b/activerecord/test/cases/transaction_callbacks_test.rb
index 2ddc449c12..869892e33f 100644
--- a/activerecord/test/cases/transaction_callbacks_test.rb
+++ b/activerecord/test/cases/transaction_callbacks_test.rb
@@ -244,6 +244,14 @@ class TransactionCallbacksTest < ActiveRecord::TestCase
assert_equal :rollback, @first.last_after_transaction_error
assert_equal [:after_rollback], @second.history
end
+
+ def test_after_rollback_callbacks_should_validate_on_condition
+ assert_raise(ArgumentError) { Topic.send(:after_rollback, :on => :save) }
+ end
+
+ def test_after_commit_callbacks_should_validate_on_condition
+ assert_raise(ArgumentError) { Topic.send(:after_commit, :on => :save) }
+ end
end