aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/number_helper_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/template/number_helper_test.rb')
-rw-r--r--actionpack/test/template/number_helper_test.rb11
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)