diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2013-03-13 05:46:34 +0000 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2013-03-13 05:46:34 +0000 |
commit | dff86e6ea07cdddb65a683f1dc7e4b7f165e8c3e (patch) | |
tree | c47394f4566e068dfab2c415de4b369d6ff21a0e | |
parent | 7169e4c71572cb96fa01317edf7b6c8ba9565f8e (diff) | |
download | rails-dff86e6ea07cdddb65a683f1dc7e4b7f165e8c3e.tar.gz rails-dff86e6ea07cdddb65a683f1dc7e4b7f165e8c3e.tar.bz2 rails-dff86e6ea07cdddb65a683f1dc7e4b7f165e8c3e.zip |
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.
-rw-r--r-- | activesupport/test/time_zone_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb index 9c3b5d0667..84c3154e53 100644 --- a/activesupport/test/time_zone_test.rb +++ b/activesupport/test/time_zone_test.rb @@ -232,6 +232,22 @@ class TimeZoneTest < ActiveSupport::TestCase 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) |