diff options
author | Geoff Buesing <gbuesing@gmail.com> | 2008-01-25 23:55:07 +0000 |
---|---|---|
committer | Geoff Buesing <gbuesing@gmail.com> | 2008-01-25 23:55:07 +0000 |
commit | dad3e835f77d402aad3b0802ee14bf7a20fd9365 (patch) | |
tree | 8242ac550be31bf80cb5ff616cafc563e942d8b2 /activesupport/test/core_ext/time_ext_test.rb | |
parent | 4b2ac708b7666510d522fc706936d3c2ea5cbb80 (diff) | |
download | rails-dad3e835f77d402aad3b0802ee14bf7a20fd9365.tar.gz rails-dad3e835f77d402aad3b0802ee14bf7a20fd9365.tar.bz2 rails-dad3e835f77d402aad3b0802ee14bf7a20fd9365.zip |
Time#- coerces TimeWithZone argument to a Time instance so that difference in seconds can be calculated. Closes #10914 [Geoff Buesing, yyyc514]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8730 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext/time_ext_test.rb')
-rw-r--r-- | activesupport/test/core_ext/time_ext_test.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb index 2377d3c63c..fef8a521da 100644 --- a/activesupport/test/core_ext/time_ext_test.rb +++ b/activesupport/test/core_ext/time_ext_test.rb @@ -454,6 +454,10 @@ class TimeExtCalculationsTest < Test::Unit::TestCase assert_equal 0, Time.utc(2000) <=> ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1, 0, 0, 0), TimeZone['UTC'] ) assert_equal(-1, Time.utc(2000) <=> ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1, 0, 0, 1), 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), TimeZone['UTC'] ) + end protected def with_timezone(new_tz = 'US/Eastern') |