aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/time_with_zone_test.rb
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2011-11-22 15:37:16 -0500
committerMarc-Andre Lafortune <github@marc-andre.ca>2011-11-22 15:37:16 -0500
commita4912078c7d345a347f023ef28c0986458bdebf5 (patch)
treea2a0a553fc815b2f6888f54b89ebd66ec82ab847 /activesupport/test/core_ext/time_with_zone_test.rb
parentcb06727b6cb7310808f5b9ce1bf254055806ba80 (diff)
downloadrails-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_with_zone_test.rb')
-rw-r--r--activesupport/test/core_ext/time_with_zone_test.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb
index b2309ae806..9d9e411c28 100644
--- a/activesupport/test/core_ext/time_with_zone_test.rb
+++ b/activesupport/test/core_ext/time_with_zone_test.rb
@@ -200,8 +200,15 @@ class TimeWithZoneTest < Test::Unit::TestCase
end
def test_eql?
- assert @twz.eql?(Time.utc(2000))
- assert @twz.eql?( ActiveSupport::TimeWithZone.new(Time.utc(2000), ActiveSupport::TimeZone["Hawaii"]) )
+ assert_equal true, @twz.eql?(Time.utc(2000))
+ assert_equal true, @twz.eql?( ActiveSupport::TimeWithZone.new(Time.utc(2000), ActiveSupport::TimeZone["Hawaii"]) )
+ assert_equal false, @twz.eql?( Time.utc(2000, 1, 1, 0, 0, 1) )
+ assert_equal false, @twz.eql?( DateTime.civil(1999, 12, 31, 23, 59, 59) )
+ end
+
+ def test_hash
+ assert_equal Time.utc(2000).hash, @twz.hash
+ assert_equal Time.utc(2000).hash, ActiveSupport::TimeWithZone.new(Time.utc(2000), ActiveSupport::TimeZone["Hawaii"]).hash
end
def test_plus_with_integer