diff options
author | Alvaro Bautista <alvarobp@gmail.com> | 2010-09-11 21:12:10 +0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-11-11 01:30:28 -0200 |
commit | 5dc7f34dca3a5b0bd65dff157ae547347e86670e (patch) | |
tree | 3a989588eaaff826172aa22cb68ed8f4e2f1c902 /activesupport/test/core_ext | |
parent | c577e90f61b060164589e7112838e461c42bfe29 (diff) | |
download | rails-5dc7f34dca3a5b0bd65dff157ae547347e86670e.tar.gz rails-5dc7f34dca3a5b0bd65dff157ae547347e86670e.tar.bz2 rails-5dc7f34dca3a5b0bd65dff157ae547347e86670e.zip |
Fix ActiveSupport::TimeWithZone#localtime method with DateTime
[#5344 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/time_with_zone_test.rb | 11 |
1 files changed, 11 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 0bb2c4a39e..5579c27215 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -36,6 +36,10 @@ class TimeWithZoneTest < Test::Unit::TestCase assert_equal @twz.object_id, @twz.in_time_zone(ActiveSupport::TimeZone['Eastern Time (US & Canada)']).object_id end + def test_localtime + assert_equal @twz.localtime, @twz.utc.getlocal + end + def test_utc? assert_equal false, @twz.utc? assert_equal true, ActiveSupport::TimeWithZone.new(Time.utc(2000), ActiveSupport::TimeZone['UTC']).utc? @@ -763,6 +767,13 @@ class TimeWithZoneMethodsForTimeAndDateTimeTest < Test::Unit::TestCase end end + def test_localtime + Time.zone_default = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] + assert_equal @dt.in_time_zone.localtime, @dt.in_time_zone.utc.to_time.getlocal + ensure + Time.zone_default = nil + end + def test_use_zone Time.zone = 'Alaska' Time.use_zone 'Hawaii' do |