aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2012-09-20 00:51:28 +0900
committerkennyj <kennyj@gmail.com>2012-09-20 00:51:28 +0900
commit105cb3d9e3cd523c00262826cd541cb10e05aa0a (patch)
treea9cf1b8fd227a6328f6963e115608d5dc803feb3 /activesupport/test
parentbf4c8fe69447c489dcae5e828114651b2213e210 (diff)
downloadrails-105cb3d9e3cd523c00262826cd541cb10e05aa0a.tar.gz
rails-105cb3d9e3cd523c00262826cd541cb10e05aa0a.tar.bz2
rails-105cb3d9e3cd523c00262826cd541cb10e05aa0a.zip
Fix #6962. AS::TimeWithZone#strftime responds incorrectly to %:z and %::z format strings.
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/time_zone_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb
index b9434489bb..bfd6863e40 100644
--- a/activesupport/test/time_zone_test.rb
+++ b/activesupport/test/time_zone_test.rb
@@ -258,6 +258,14 @@ class TimeZoneTest < ActiveSupport::TestCase
assert_equal "-0500", zone.formatted_offset(false)
end
+ def test_z_format_strings
+ zone = ActiveSupport::TimeZone['Tokyo']
+ twz = zone.now
+ assert_equal '+0900', twz.strftime('%z')
+ assert_equal '+09:00', twz.strftime('%:z')
+ assert_equal '+09:00:00', twz.strftime('%::z')
+ end
+
def test_formatted_offset_zero
zone = ActiveSupport::TimeZone['London']
assert_equal "+00:00", zone.formatted_offset