aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/time_with_zone_test.rb
diff options
context:
space:
mode:
authorVasiliy Ermolovich <younash@gmail.com>2012-05-06 23:33:12 +0300
committerAndrew White <andyw@pixeltrix.co.uk>2013-01-08 10:33:45 +0000
commitd39d878d2b250636256ecf54473d365ffb62eb6d (patch)
treea321d35ef170b65aaaa3da32dc7283ddf9687b61 /activesupport/test/core_ext/time_with_zone_test.rb
parentd9a048001f869a3252cb85477f775de9860d615f (diff)
downloadrails-d39d878d2b250636256ecf54473d365ffb62eb6d.tar.gz
rails-d39d878d2b250636256ecf54473d365ffb62eb6d.tar.bz2
rails-d39d878d2b250636256ecf54473d365ffb62eb6d.zip
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 <andyw@pixeltrix.co.uk>
Diffstat (limited to 'activesupport/test/core_ext/time_with_zone_test.rb')
-rw-r--r--activesupport/test/core_ext/time_with_zone_test.rb10
1 files changed, 10 insertions, 0 deletions
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