Permalink
Browse files

Add regression tests for #9678

The bug with `ActiveSupport::TimeZone.parse` described in #9678 was
unwittingly fixed in 005d910 so add some tests to prevent regression.
  • Loading branch information...
1 parent 7169e4c commit dff86e6ea07cdddb65a683f1dc7e4b7f165e8c3e @pixeltrix pixeltrix committed Mar 13, 2013
Showing with 16 additions and 0 deletions.
  1. +16 −0 activesupport/test/time_zone_test.rb
@@ -232,6 +232,22 @@ def test_parse_with_javascript_date
assert_equal Time.utc(2012, 5, 28, 7, 0, 0), twz.utc
end
+ def test_parse_doesnt_use_local_dst
+ with_env_tz 'US/Eastern' do
+ zone = ActiveSupport::TimeZone['UTC']
+ twz = zone.parse('2013-03-10 02:00:00')
+ assert_equal Time.utc(2013, 3, 10, 2, 0, 0), twz.time
+ end
+ end
+
+ def test_parse_handles_dst_jump
+ with_env_tz 'US/Eastern' do
+ zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)']
+ twz = zone.parse('2013-03-10 02:00:00')
+ assert_equal Time.utc(2013, 3, 10, 3, 0, 0), twz.time
+ end
+ end
+
def test_utc_offset_lazy_loaded_from_tzinfo_when_not_passed_in_to_initialize
tzinfo = TZInfo::Timezone.get('America/New_York')
zone = ActiveSupport::TimeZone.create(tzinfo.name, nil, tzinfo)

0 comments on commit dff86e6

Please sign in to comment.