From d3f178bb92473b4d7bb400be56c983203b1662e9 Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Fri, 29 Jan 2016 11:46:39 +0530 Subject: Change number_to_currency behavior for checking negativity - Instead of using `to_f.phase`, just use `to_f.negative`?. - This change works same for all cases except when number is "-0.0". -0.0.to_f.negative? => false -0.0.to_f.phase? => pi - So -0.0 will be treated as positive from now onwards. - So this change reverts changes from https://github.com/rails/rails/pull/6512. - But it should be acceptable as we could not find any currency which supports negative zeros. --- activesupport/test/number_helper_test.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'activesupport/test') diff --git a/activesupport/test/number_helper_test.rb b/activesupport/test/number_helper_test.rb index b3464462c8..6696111476 100644 --- a/activesupport/test/number_helper_test.rb +++ b/activesupport/test/number_helper_test.rb @@ -74,7 +74,6 @@ module ActiveSupport assert_equal("1,234,567,890.50 Kč", number_helper.number_to_currency("1234567890.50", {:unit => "Kč", :format => "%n %u"})) assert_equal("1,234,567,890.50 - Kč", number_helper.number_to_currency("-1234567890.50", {:unit => "Kč", :format => "%n %u", :negative_format => "%n - %u"})) assert_equal("0.00", number_helper.number_to_currency(+0.0, {:unit => "", :negative_format => "(%n)"})) - assert_equal("(0.00)", number_helper.number_to_currency(-0.0, {:unit => "", :negative_format => "(%n)"})) end end -- cgit v1.2.3