diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2012-12-01 20:43:07 +0000 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2012-12-01 21:05:42 +0000 |
commit | c89b6c4cdce7ee55ed3665c099d914222fe0344a (patch) | |
tree | c44170809b612cf0f09109442b4edfb3be47746f /activesupport/test | |
parent | 583cc11dd75676665e1d106541979d94864ee663 (diff) | |
download | rails-c89b6c4cdce7ee55ed3665c099d914222fe0344a.tar.gz rails-c89b6c4cdce7ee55ed3665c099d914222fe0344a.tar.bz2 rails-c89b6c4cdce7ee55ed3665c099d914222fe0344a.zip |
Only take the date parts from Time.zone.now
When there are missing components in the Hash returned by
Date._parse only the date components should default to the
value of Time.zone.now, the time components should all
default to zero.
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/time_zone_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb index bdeb80a294..9c3b5d0667 100644 --- a/activesupport/test/time_zone_test.rb +++ b/activesupport/test/time_zone_test.rb @@ -219,6 +219,13 @@ class TimeZoneTest < ActiveSupport::TestCase end end + def test_parse_with_missing_time_components + zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] + zone.stubs(:now).returns zone.local(1999, 12, 31, 12, 59, 59) + twz = zone.parse('2012-12-01') + assert_equal Time.utc(2012, 12, 1), twz.time + end + def test_parse_with_javascript_date zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] twz = zone.parse("Mon May 28 2012 00:00:00 GMT-0700 (PDT)") |