diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-03-17 10:55:21 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-03-17 10:55:21 +0100 |
commit | 378c8d2c996558aa4108280d5f0db8daf040d0fc (patch) | |
tree | 568c4b8bad12a6b477fc705d2e703c86ce8e1168 /activesupport/test | |
parent | a0c1c18e4d85e2d95241a1924683b396bd3ae4e5 (diff) | |
download | rails-378c8d2c996558aa4108280d5f0db8daf040d0fc.tar.gz rails-378c8d2c996558aa4108280d5f0db8daf040d0fc.tar.bz2 rails-378c8d2c996558aa4108280d5f0db8daf040d0fc.zip |
fix `number_to_percentage` with `Float::NAN`, `Float::INFINITY`.
Closes #14405.
This is a follow-up to 9e997e9039435617b6a844158f5437e97f6bc107 to restore
the documented behavior.
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/number_helper_test.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/activesupport/test/number_helper_test.rb b/activesupport/test/number_helper_test.rb index 6d8d835de7..9bdb92024e 100644 --- a/activesupport/test/number_helper_test.rb +++ b/activesupport/test/number_helper_test.rb @@ -79,6 +79,9 @@ module ActiveSupport assert_equal("123.4%", number_helper.number_to_percentage(123.400, :precision => 3, :strip_insignificant_zeros => true)) assert_equal("1.000,000%", number_helper.number_to_percentage(1000, :delimiter => '.', :separator => ',')) assert_equal("1000.000 %", number_helper.number_to_percentage(1000, :format => "%n %")) + assert_equal("98a%", number_helper.number_to_percentage("98a")) + assert_equal("NaN%", number_helper.number_to_percentage(Float::NAN)) + assert_equal("Inf%", number_helper.number_to_percentage(Float::INFINITY)) end end |