The personal finance app for everyone (by everyone)
Ruby
fix(money): use the en-IE locale key when formatting euros (#4921)
kevin84ce90640625
diff --git a/lib/money/formatting.rb b/lib/money/formatting.rbindex 36a1355122..8aba01d1ec 100644--- a/lib/money/formatting.rb+++ b/lib/money/formatting.rb@@ -147,7 +147,7 @@ module Money::Formattingcase [ currency.iso_code, locale_sym ]when [ "EUR", :pt ]{ delimiter: ".", separator: ",", format: "%u %n" }- when [ "EUR", :en ], [ "EUR", :en_IE ]+ when [ "EUR", :en ], [ "EUR", :"en-IE" ], [ "EUR", :en_IE ]{ delimiter: ",", separator: "." }else{}diff --git a/test/lib/money/formatting_test.rb b/test/lib/money/formatting_test.rbindex 4e1244948f..294ca29ca7 100644--- a/test/lib/money/formatting_test.rb+++ b/test/lib/money/formatting_test.rb@@ -33,6 +33,16 @@ class Money::FormattingTest < ActiveSupport::TestCaseendend+ test "EUR in en-IE uses English grouping, not the currency's European punctuation" do+ money = Money.new(BigDecimal("1234.5"), "EUR")++ I18n.with_locale(:"en-IE") do+ assert_equal ",", money.format_options(:"en-IE")[:delimiter]+ assert_equal ".", money.format_options(:"en-IE")[:separator]+ assert_equal "€1,234.50", money.format+ end+ end+test "plain formatting does not go through number_to_currency" domoney = Money.new(BigDecimal("1234.5"), "USD")money.expects(:number_to_currency).never