diff options
author | Geoff Buesing <gbuesing@gmail.com> | 2008-01-12 20:44:31 +0000 |
---|---|---|
committer | Geoff Buesing <gbuesing@gmail.com> | 2008-01-12 20:44:31 +0000 |
commit | e9dad7496d8249a1487a471978d316a4360627d1 (patch) | |
tree | d2a5d46d102576aa985ae3eb02a04b69f0b9d697 /activesupport/test/core_ext | |
parent | 7501451d7f417a304a56ac65f0b203c942920732 (diff) | |
download | rails-e9dad7496d8249a1487a471978d316a4360627d1.tar.gz rails-e9dad7496d8249a1487a471978d316a4360627d1.tar.bz2 rails-e9dad7496d8249a1487a471978d316a4360627d1.zip |
Refactor number-to-HH:MM-string conversion logic from TimeZone#formatted_offset to reusable Numeric#to_utc_offset_s method
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8635 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/numeric_ext_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/numeric_ext_test.rb b/activesupport/test/core_ext/numeric_ext_test.rb index 8672229fbb..35f90aa776 100644 --- a/activesupport/test/core_ext/numeric_ext_test.rb +++ b/activesupport/test/core_ext/numeric_ext_test.rb @@ -145,3 +145,18 @@ 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 |