diff options
author | Marc-Andre Lafortune <github@marc-andre.ca> | 2011-11-22 15:37:16 -0500 |
---|---|---|
committer | Marc-Andre Lafortune <github@marc-andre.ca> | 2011-11-22 15:37:16 -0500 |
commit | a4912078c7d345a347f023ef28c0986458bdebf5 (patch) | |
tree | a2a0a553fc815b2f6888f54b89ebd66ec82ab847 /activesupport/test/core_ext/time_ext_test.rb | |
parent | cb06727b6cb7310808f5b9ce1bf254055806ba80 (diff) | |
download | rails-a4912078c7d345a347f023ef28c0986458bdebf5.tar.gz rails-a4912078c7d345a347f023ef28c0986458bdebf5.tar.bz2 rails-a4912078c7d345a347f023ef28c0986458bdebf5.zip |
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.rb | 6 |
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 ab9be4b18b..e7090eed08 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 |