diff options
author | gbuesing <gbuesing@gmail.com> | 2009-01-04 13:58:08 -0600 |
---|---|---|
committer | gbuesing <gbuesing@gmail.com> | 2009-01-04 13:58:08 -0600 |
commit | d2a1c2778e76ba30431121d0a9062272e0c90405 (patch) | |
tree | 3a697226be727a0c7f3f57e3b2ba65478b274b81 /activesupport/test | |
parent | f00e86d7e9c7a4689a49fc085bcb757c5a2c0b03 (diff) | |
download | rails-d2a1c2778e76ba30431121d0a9062272e0c90405.tar.gz rails-d2a1c2778e76ba30431121d0a9062272e0c90405.tar.bz2 rails-d2a1c2778e76ba30431121d0a9062272e0c90405.zip |
TimeWithZone#- gives correct result with wrapped DateTime, and with DateTime argument
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/time_with_zone_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb index dc36336239..7c8fb7dd94 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -256,6 +256,15 @@ class TimeWithZoneTest < Test::Unit::TestCase twz2 = ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 2), ActiveSupport::TimeZone['UTC'] ) assert_equal 86_400.0, twz2 - twz1 end + + def test_minus_with_datetime + assert_equal 86_400.0, ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 2), ActiveSupport::TimeZone['UTC'] ) - DateTime.civil(2000, 1, 1) + end + + def test_minus_with_wrapped_datetime + assert_equal 86_400.0, ActiveSupport::TimeWithZone.new( DateTime.civil(2000, 1, 2), ActiveSupport::TimeZone['UTC'] ) - Time.utc(2000, 1, 1) + assert_equal 86_400.0, ActiveSupport::TimeWithZone.new( DateTime.civil(2000, 1, 2), ActiveSupport::TimeZone['UTC'] ) - DateTime.civil(2000, 1, 1) + end def test_plus_and_minus_enforce_spring_dst_rules silence_warnings do # silence warnings raised by tzinfo gem |