diff options
author | Diego Carrion <dc.rec1@gmail.com> | 2011-04-27 20:29:03 -0300 |
---|---|---|
committer | Diego Carrion <dc.rec1@gmail.com> | 2011-04-27 20:29:03 -0300 |
commit | 07bbaaa3b14d7048a3e43851aed199b8b515a820 (patch) | |
tree | f8799bf8cdcbf0d878fe9ad4044f02cc89dac675 /actionpack/test | |
parent | e190569cfb9a8cef2acaba947c579f883b254935 (diff) | |
download | rails-07bbaaa3b14d7048a3e43851aed199b8b515a820.tar.gz rails-07bbaaa3b14d7048a3e43851aed199b8b515a820.tar.bz2 rails-07bbaaa3b14d7048a3e43851aed199b8b515a820.zip |
added a :prefix option to number_to_human_size
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/number_helper_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/actionpack/test/template/number_helper_test.rb b/actionpack/test/template/number_helper_test.rb index 23a7e17e65..63b92aadf4 100644 --- a/actionpack/test/template/number_helper_test.rb +++ b/actionpack/test/template/number_helper_test.rb @@ -172,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) |