aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2014-05-11 16:00:55 +0100
committerAndrew White <andyw@pixeltrix.co.uk>2014-05-11 16:00:55 +0100
commit7dce1e6d98f78d0cce963456f226811c22bb645d (patch)
treed613c225849da4bf91ee87c30d17815fc6e89eb5 /activesupport/test
parent0e909cd3078bab352eb741426024334afe0d6820 (diff)
downloadrails-7dce1e6d98f78d0cce963456f226811c22bb645d.tar.gz
rails-7dce1e6d98f78d0cce963456f226811c22bb645d.tar.bz2
rails-7dce1e6d98f78d0cce963456f226811c22bb645d.zip
Tidy up implementation of #15010
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/time_zone_test.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb
index 37276b71e1..127bcc2b4d 100644
--- a/activesupport/test/time_zone_test.rb
+++ b/activesupport/test/time_zone_test.rb
@@ -255,10 +255,12 @@ class TimeZoneTest < ActiveSupport::TestCase
end
def test_parse_with_day_omitted
- zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)']
- zone.stubs(:now).returns zone.local(1999, 12, 31)
- twz = zone.parse('Feb')
- assert_equal Time.utc(1999, 2, 1), twz.time
+ with_env_tz 'US/Eastern' do
+ zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)']
+ assert_equal Time.local(2000, 2, 1), zone.parse('Feb', Time.local(2000, 1, 1))
+ assert_equal Time.local(2005, 2, 1), zone.parse('Feb 2005', Time.local(2000, 1, 1))
+ assert_equal Time.local(2005, 2, 2), zone.parse('2 Feb 2005', Time.local(2000, 1, 1))
+ end
end
def test_parse_should_not_black_out_system_timezone_dst_jump