From 2cc2fa3633edd96773023c6b09d07c7b9d9b841d Mon Sep 17 00:00:00 2001 From: Yasyf Mohamedali Date: Tue, 3 Mar 2015 15:16:47 -0500 Subject: Take DST into account when locating TimeZone from Numeric. When given a specific offset, use the first result found where the total current offset (including any periodic deviations such as DST) from UTC is equal. --- activesupport/test/core_ext/time_with_zone_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb index 92c233d567..0f5522b712 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -867,6 +867,13 @@ class TimeWithZoneMethodsForTimeAndDateTimeTest < ActiveSupport::TestCase end end + def test_in_time_zone_with_dst + travel_to(Time.utc(2014, 5, 20, 4, 59, 59)) + time = Time.now.in_time_zone(-4) + assert_equal (-4*3600), time.time_zone.utc_total_offset + travel_back + end + def test_in_time_zone_with_invalid_argument assert_raise(ArgumentError) { @t.in_time_zone("No such timezone exists") } assert_raise(ArgumentError) { @dt.in_time_zone("No such timezone exists") } -- cgit v1.2.3