diff options
Diffstat (limited to 'actionpack/test/template/number_helper_test.rb')
-rw-r--r-- | actionpack/test/template/number_helper_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/test/template/number_helper_test.rb b/actionpack/test/template/number_helper_test.rb index c8d50ebf75..63b92aadf4 100644 --- a/actionpack/test/template/number_helper_test.rb +++ b/actionpack/test/template/number_helper_test.rb @@ -32,6 +32,7 @@ class NumberHelperTest < ActionView::TestCase assert_equal("555-1234", number_to_phone(5551234)) assert_equal("800-555-1212", number_to_phone(8005551212)) assert_equal("(800) 555-1212", number_to_phone(8005551212, {:area_code => true})) + assert_equal("", number_to_phone("", {:area_code => true})) assert_equal("800 555 1212", number_to_phone(8005551212, {:delimiter => " "})) assert_equal("(800) 555-1212 x 123", number_to_phone(8005551212, {:area_code => true, :extension => 123})) assert_equal("800-555-1212", number_to_phone(8005551212, :extension => " ")) @@ -171,6 +172,17 @@ class NumberHelperTest < ActionView::TestCase assert_equal '10 Bytes', number_to_human_size(10) end + def test_number_to_human_size_with_si_prefix + assert_equal '3 Bytes', number_to_human_size(3.14159265, :prefix => :si) + assert_equal '123 Bytes', number_to_human_size(123.0, :prefix => :si) + assert_equal '123 Bytes', number_to_human_size(123, :prefix => :si) + assert_equal '1.23 KB', number_to_human_size(1234, :prefix => :si) + assert_equal '12.3 KB', number_to_human_size(12345, :prefix => :si) + assert_equal '1.23 MB', number_to_human_size(1234567, :prefix => :si) + assert_equal '1.23 GB', number_to_human_size(1234567890, :prefix => :si) + assert_equal '1.23 TB', number_to_human_size(1234567890123, :prefix => :si) + end + def test_number_to_human_size_with_options_hash assert_equal '1.2 MB', number_to_human_size(1234567, :precision => 2) assert_equal '3 Bytes', number_to_human_size(3.14159265, :precision => 4) |