From 856a4dcf1207e888b23016cac6a64582051aa0ff Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 18 Mar 2008 17:56:05 +0000 Subject: Refactor filters to use Active Support callbacks. Closes #11235. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9055 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/test/callbacks_test.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'activesupport/test') diff --git a/activesupport/test/callbacks_test.rb b/activesupport/test/callbacks_test.rb index 6d390bbc5c..3f8cb7f01a 100644 --- a/activesupport/test/callbacks_test.rb +++ b/activesupport/test/callbacks_test.rb @@ -94,3 +94,24 @@ class ConditionalCallbackTest < Test::Unit::TestCase ], person.history end end + +class CallbackTest < Test::Unit::TestCase + def test_eql + callback = Callback.new(:before, :save, :identifier => :lifesaver) + assert callback.eql?(Callback.new(:before, :save, :identifier => :lifesaver)) + assert callback.eql?(Callback.new(:before, :save)) + assert callback.eql?(:lifesaver) + assert callback.eql?(:save) + assert !callback.eql?(Callback.new(:before, :destroy)) + assert !callback.eql?(:destroy) + end + + def test_dup + a = Callback.new(:before, :save) + assert_equal({}, a.options) + b = a.dup + b.options[:unless] = :pigs_fly + assert_equal({:unless => :pigs_fly}, b.options) + assert_equal({}, a.options) + end +end -- cgit v1.2.3