aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorSean Walbran <swalbran@socialcast.com>2013-05-07 13:22:52 -0500
committerSean Walbran <swalbran@socialcast.com>2013-05-07 13:22:52 -0500
commit9003a422f2a717ef11409245bfb8e81018be56c4 (patch)
tree0406cdecdd979676fdb38d52fed2f375e619f9f0 /activesupport/test
parent3043d45eefc3776d5f3a9e7d212a01f99d869ef8 (diff)
downloadrails-9003a422f2a717ef11409245bfb8e81018be56c4.tar.gz
rails-9003a422f2a717ef11409245bfb8e81018be56c4.tar.bz2
rails-9003a422f2a717ef11409245bfb8e81018be56c4.zip
fix issue #10502, do not recompute method name for already-stringified object filter
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/callbacks_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/activesupport/test/callbacks_test.rb b/activesupport/test/callbacks_test.rb
index edc8edd8a6..f71e780c42 100644
--- a/activesupport/test/callbacks_test.rb
+++ b/activesupport/test/callbacks_test.rb
@@ -102,6 +102,9 @@ module CallbacksTest
def no; false; end
end
+ class PersonForProgrammaticSkipping < Person
+ end
+
class ParentController
include ActiveSupport::Callbacks
@@ -449,6 +452,25 @@ module CallbacksTest
[:after_save, :symbol]
], person.history
end
+
+ def test_skip_person_programmatically
+ PersonForProgrammaticSkipping._save_callbacks.each do |save_callback|
+ if "before" == save_callback.kind.to_s
+ PersonForProgrammaticSkipping.skip_callback("save", save_callback.kind, save_callback.filter)
+ end
+ end
+ person = PersonForProgrammaticSkipping.new
+ assert_equal [], person.history
+ person.save
+ assert_equal [
+ [:after_save, :block],
+ [:after_save, :class],
+ [:after_save, :object],
+ [:after_save, :proc],
+ [:after_save, :string],
+ [:after_save, :symbol]
+ ], person.history
+ end
end
class CallbacksTest < ActiveSupport::TestCase