From d39d878d2b250636256ecf54473d365ffb62eb6d Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Sun, 6 May 2012 23:33:12 +0300 Subject: Wrap time ranges with timezones, closes #8807 (cherry picked from commit e2e513621d732abb8efff9120bd9a444836720d6) (cherry picked from commit dcdde7da481e11660634278a8004175a1ce20f39) Backport of #6183, original issue was #6179 Conflicts: activesupport/lib/active_support/core_ext/time/calculations.rb activesupport/test/core_ext/time_ext_test Signed-off-by: Andrew White --- activesupport/test/core_ext/time_with_zone_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'activesupport/test/core_ext/time_with_zone_test.rb') diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb index 84afee6c84..b80a68711c 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -80,6 +80,16 @@ class TimeWithZoneTest < Test::Unit::TestCase ActiveSupport.use_standard_json_time_format = old end + if RUBY_VERSION >= '1.9' + def test_nsec + local = Time.local(2011,6,7,23,59,59,Rational(999999999, 1000)) + with_zone = ActiveSupport::TimeWithZone.new(nil, ActiveSupport::TimeZone["Hawaii"], local) + + assert_equal local.nsec, with_zone.nsec + assert_equal with_zone.nsec, 999999999 + end + end + def test_strftime assert_equal '1999-12-31 19:00:00 EST -0500', @twz.strftime('%Y-%m-%d %H:%M:%S %Z %z') end -- cgit v1.2.3