File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
lib/active_support/core_ext/time Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Original file line Diff line number Diff line change @@ -9,7 +9,7 @@ class Time
9
class << self
9
class << self
10
# Overriding case equality method so that it returns true for ActiveSupport::TimeWithZone instances
10
# Overriding case equality method so that it returns true for ActiveSupport::TimeWithZone instances
11
def ===( other )
11
def ===( other )
12
- other . is_a? ( :: Time )
12
+ super || ( self == Time && other . is_a? ( ActiveSupport :: TimeWithZone ) )
13
end
13
end
14
14
15
# Return the number of days in the given month.
15
# Return the number of days in the given month.
Original file line number Original file line Diff line number Diff line change @@ -764,7 +764,10 @@ def test_time_created_with_local_constructor_cannot_represent_times_during_hour_
764
def test_case_equality
764
def test_case_equality
765
assert Time === Time . utc ( 2000 )
765
assert Time === Time . utc ( 2000 )
766
assert Time === ActiveSupport ::TimeWithZone . new ( Time . utc ( 2000 ) , ActiveSupport ::TimeZone [ 'UTC' ] )
766
assert Time === ActiveSupport ::TimeWithZone . new ( Time . utc ( 2000 ) , ActiveSupport ::TimeZone [ 'UTC' ] )
767
+ assert Time === Class . new ( Time ) . utc ( 2000 )
767
assert_equal false , Time === DateTime . civil ( 2000 )
768
assert_equal false , Time === DateTime . civil ( 2000 )
769
+ assert_equal false , Class . new ( Time ) === Time . utc ( 2000 )
770
+ assert_equal false , Class . new ( Time ) === ActiveSupport ::TimeWithZone . new ( Time . utc ( 2000 ) , ActiveSupport ::TimeZone [ 'UTC' ] )
768
end
771
end
769
772
770
protected
773
protected
You can’t perform that action at this time.
0 commit comments