aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/time_ext_test.rb
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2011-11-22 13:01:37 -0800
committerYehuda Katz <wycats@gmail.com>2011-11-22 13:01:37 -0800
commita93ee92da2b9ba83e3a3fe0b8d4dd5cac2790f15 (patch)
tree46a33467eca7a163117ed439c65b02e96248060e /activesupport/test/core_ext/time_ext_test.rb
parent9b7be78820c5510b2f841dc2197ed3a32ad8dd19 (diff)
parenta4912078c7d345a347f023ef28c0986458bdebf5 (diff)
downloadrails-a93ee92da2b9ba83e3a3fe0b8d4dd5cac2790f15.tar.gz
rails-a93ee92da2b9ba83e3a3fe0b8d4dd5cac2790f15.tar.bz2
rails-a93ee92da2b9ba83e3a3fe0b8d4dd5cac2790f15.zip
Merge pull request #3725 from marcandre/twz_eql
Fix inconsistencies with Time{WithZone}#{hash,eql?}
Diffstat (limited to 'activesupport/test/core_ext/time_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/time_ext_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb
index a1e088a28d..d2ff44e1b4 100644
--- a/activesupport/test/core_ext/time_ext_test.rb
+++ b/activesupport/test/core_ext/time_ext_test.rb
@@ -744,6 +744,12 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
assert_equal(-1, Time.utc(2000) <=> ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1, 0, 0, 1), ActiveSupport::TimeZone['UTC'] ))
end
+ def test_eql?
+ assert_equal true, Time.utc(2000).eql?( ActiveSupport::TimeWithZone.new(Time.utc(2000), ActiveSupport::TimeZone['UTC']) )
+ assert_equal true, Time.utc(2000).eql?( ActiveSupport::TimeWithZone.new(Time.utc(2000), ActiveSupport::TimeZone["Hawaii"]) )
+ assert_equal false,Time.utc(2000, 1, 1, 0, 0, 1).eql?( ActiveSupport::TimeWithZone.new(Time.utc(2000), ActiveSupport::TimeZone['UTC']) )
+ end
+
def test_minus_with_time_with_zone
assert_equal 86_400.0, Time.utc(2000, 1, 2) - ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1), ActiveSupport::TimeZone['UTC'] )
end