aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-08-05 01:00:54 +0000
committerMichael Koziarski <michael@koziarski.com>2007-08-05 01:00:54 +0000
commitab5e1f15a67b22410835a84ba11a926f50b31cbe (patch)
treeeefac0c80de82101f9e2ec2606afb8ca8adad291 /actionpack/test
parentc4c6662498cb85feb407ccb86d8694e38f439f31 (diff)
downloadrails-ab5e1f15a67b22410835a84ba11a926f50b31cbe.tar.gz
rails-ab5e1f15a67b22410835a84ba11a926f50b31cbe.tar.bz2
rails-ab5e1f15a67b22410835a84ba11a926f50b31cbe.zip
Fix number_to_human_size when using different precisions. Closes #7536. [RichardStrand, mpalmer]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7275 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/template/number_helper_test.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/actionpack/test/template/number_helper_test.rb b/actionpack/test/template/number_helper_test.rb
index 9cc203bc42..19ca471245 100644
--- a/actionpack/test/template/number_helper_test.rb
+++ b/actionpack/test/template/number_helper_test.rb
@@ -83,6 +83,10 @@ class NumberHelperTest < Test::Unit::TestCase
assert_equal '1.18 MB', number_to_human_size(1234567, 2)
assert_equal '3 Bytes', number_to_human_size(3.14159265, 4)
assert_equal("123 Bytes", number_to_human_size("123"))
+ assert_equal '1.01 KB', number_to_human_size(1.0123.kilobytes, 2)
+ assert_equal '1.01 KB', number_to_human_size(1.0100.kilobytes, 4)
+ assert_equal '10 KB', number_to_human_size(10.000.kilobytes, 4)
+ assert_equal '1 Byte', number_to_human_size(1.1)
assert_nil number_to_human_size('x')
assert_nil number_to_human_size(nil)
end