diff options
Diffstat (limited to 'activesupport/test/callbacks_test.rb')
-rw-r--r-- | activesupport/test/callbacks_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
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 |