diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2010-01-07 00:05:06 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-01-07 00:06:20 -0800 |
commit | a323b83acfe6e02812ec3b7b4ce912b07c85220e (patch) | |
tree | a759544b3252bb3c27867771cc6bb30d65656ddc /activesupport/test/core_ext | |
parent | 816ba1e15a709337a99a931e80dddfe5bf972de5 (diff) | |
download | rails-a323b83acfe6e02812ec3b7b4ce912b07c85220e.tar.gz rails-a323b83acfe6e02812ec3b7b4ce912b07c85220e.tar.bz2 rails-a323b83acfe6e02812ec3b7b4ce912b07c85220e.zip |
Remove unneeded reliance on super -> method_missing quirk
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/duration_test.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index 42b4f10172..6530de1ef4 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -2,6 +2,31 @@ require 'abstract_unit' require 'active_support/time' class DurationTest < ActiveSupport::TestCase + def test_is_a + d = 1.day + assert d.is_a?(ActiveSupport::Duration) + assert d.is_a?(Numeric) + assert d.is_a?(Fixnum) + assert !d.is_a?(Hash) + + k = Class.new + class << k; undef_method :== end + assert !d.is_a?(k) + end + + def test_threequals + assert ActiveSupport::Duration === 1.day + assert !(ActiveSupport::Duration === 1.day.to_i) + assert !(ActiveSupport::Duration === 'foo') + assert !(ActiveSupport::Duration === ActiveSupport::BasicObject.new) + end + + def test_equals + assert 1.day == 1.day + assert 1.day == 1.day.to_i + assert !(1.day == 'foo') + end + def test_inspect assert_equal '0 seconds', 0.seconds.inspect assert_equal '1 month', 1.month.inspect |