From e094940c2b5a5163504859efd3a0bcc49c40451e Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 23 Mar 2009 22:01:51 -0700 Subject: Move Numeric#to_utc_offset_s to TimeZone.seconds_to_utc_offset --- activesupport/test/core_ext/numeric_ext_test.rb | 15 --------------- activesupport/test/time_zone_test.rb | 12 ++++++++++++ 2 files changed, 12 insertions(+), 15 deletions(-) (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/numeric_ext_test.rb b/activesupport/test/core_ext/numeric_ext_test.rb index 5401ed7c7e..1beb038d56 100644 --- a/activesupport/test/core_ext/numeric_ext_test.rb +++ b/activesupport/test/core_ext/numeric_ext_test.rb @@ -145,18 +145,3 @@ class NumericExtSizeTest < Test::Unit::TestCase assert_equal 3458764513820540928, 3.exabyte end end - -class NumericExtConversionsTest < Test::Unit::TestCase - - def test_to_utc_offset_s_with_colon - assert_equal "-06:00", -21_600.to_utc_offset_s - assert_equal "+00:00", 0.to_utc_offset_s - assert_equal "+05:00", 18_000.to_utc_offset_s - end - - def test_to_utc_offset_s_without_colon - assert_equal "-0600", -21_600.to_utc_offset_s(false) - assert_equal "+0000", 0.to_utc_offset_s(false) - assert_equal "+0500", 18_000.to_utc_offset_s(false) - end -end diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb index b01f62460a..d3dbeda2c8 100644 --- a/activesupport/test/time_zone_test.rb +++ b/activesupport/test/time_zone_test.rb @@ -196,6 +196,18 @@ class TimeZoneTest < Test::Unit::TestCase assert_equal(-18_000, zone.utc_offset) end + def test_seconds_to_utc_offset_with_colon + assert_equal "-06:00", TimeZone.seconds_to_utc_offset(-21_600) + assert_equal "+00:00", TimeZone.seconds_to_utc_offset(0) + assert_equal "+05:00", TimeZone.seconds_to_utc_offset(18_000) + end + + def test_seconds_to_utc_offset_without_colon + assert_equal "-0600", TimeZone.seconds_to_utc_offset(-21_600) + assert_equal "+0000", TimeZone.seconds_to_utc_offset(0) + assert_equal "+0500", TimeZone.seconds_to_utc_offset(18_000) + end + def test_formatted_offset_positive zone = ActiveSupport::TimeZone['Moscow'] assert_equal "+03:00", zone.formatted_offset -- cgit v1.2.3