diff options
author | José Valim <jose.valim@gmail.com> | 2011-04-28 05:38:46 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-04-28 05:38:46 -0700 |
commit | bf50222b0b5417af554a9a4a8d277f4fccea8f8c (patch) | |
tree | 1d1b29a12fc890f6becc1a160de4d9f23b27c207 /actionpack/test/template | |
parent | 533efd891a9f3d747e8a98e6730e56307e1c36b9 (diff) | |
parent | 07bbaaa3b14d7048a3e43851aed199b8b515a820 (diff) | |
download | rails-bf50222b0b5417af554a9a4a8d277f4fccea8f8c.tar.gz rails-bf50222b0b5417af554a9a4a8d277f4fccea8f8c.tar.bz2 rails-bf50222b0b5417af554a9a4a8d277f4fccea8f8c.zip |
Merged pull request #327 from dcrec1/master.
Prefix option for number_to_human_size
Diffstat (limited to 'actionpack/test/template')
-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) |