diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-03-18 17:56:05 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-03-18 17:56:05 +0000 |
commit | 856a4dcf1207e888b23016cac6a64582051aa0ff (patch) | |
tree | 6ab4bf4149122d70f457e597bf4dc5e4defe5629 /activesupport/test | |
parent | 9af9fc3da19fb06e965d977339bfb79ab014bcb7 (diff) | |
download | rails-856a4dcf1207e888b23016cac6a64582051aa0ff.tar.gz rails-856a4dcf1207e888b23016cac6a64582051aa0ff.tar.bz2 rails-856a4dcf1207e888b23016cac6a64582051aa0ff.zip |
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
Diffstat (limited to 'activesupport/test')
-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 |