aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorDon Wilson <robert.don.wilson@gmail.com>2010-12-16 11:37:11 -0200
committerPiotr Sarnacki <drogus@gmail.com>2010-12-17 11:32:19 +0100
commit006ec77e60163d57d655479602230672d98e0f10 (patch)
treea0a8e48f052ed8f8322f38a40e117f3044945028 /actionpack/test
parent3b9120fa52b76fb8591fe1d0db85d1a940e867d0 (diff)
downloadrails-006ec77e60163d57d655479602230672d98e0f10.tar.gz
rails-006ec77e60163d57d655479602230672d98e0f10.tar.bz2
rails-006ec77e60163d57d655479602230672d98e0f10.zip
Fixed number_with_precision rounding error [#6182 state:resolved]
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/template/number_helper_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/actionpack/test/template/number_helper_test.rb b/actionpack/test/template/number_helper_test.rb
index ab127521ad..6b234cfbb9 100644
--- a/actionpack/test/template/number_helper_test.rb
+++ b/actionpack/test/template/number_helper_test.rb
@@ -100,6 +100,11 @@ class NumberHelperTest < ActionView::TestCase
assert_equal("0", number_with_precision(0, :precision => 0))
assert_equal("0.00100", number_with_precision(0.001, :precision => 5))
assert_equal("0.001", number_with_precision(0.00111, :precision => 3))
+ assert_equal("10.00", number_with_precision(9.995, :precision => 2))
+ assert_equal("11.00", number_with_precision(10.995, :precision => 2))
+ assert_equal("10.0", number_with_precision(9.995, :precision => 3, :significant => true))
+ assert_equal("9.99", number_with_precision(9.994, :precision => 3, :significant => true))
+ assert_equal("11.0", number_with_precision(10.995, :precision => 3, :significant => true))
end
def test_number_with_precision_with_custom_delimiter_and_separator