diff options
-rw-r--r-- | activesupport/lib/active_support/duration.rb | 1 | ||||
-rw-r--r-- | activesupport/test/core_ext/duration_test.rb | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/duration.rb b/activesupport/lib/active_support/duration.rb index db5afb5324..cd0d66a482 100644 --- a/activesupport/lib/active_support/duration.rb +++ b/activesupport/lib/active_support/duration.rb @@ -38,6 +38,7 @@ module ActiveSupport def is_a?(klass) #:nodoc: Duration == klass || value.is_a?(klass) end + alias :kind_of? :is_a? # Returns true if <tt>other</tt> is also a Duration instance with the # same <tt>value</tt>, or if <tt>other == value</tt>. diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index 05f529dc7d..710c221fac 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -5,6 +5,7 @@ class DurationTest < ActiveSupport::TestCase def test_is_a d = 1.day assert d.is_a?(ActiveSupport::Duration) + assert_kind_of ActiveSupport::Duration, d assert_kind_of Numeric, d assert_kind_of Fixnum, d assert !d.is_a?(Hash) |