Skip to content

Commit d203bd9

Browse files
authored
Merge pull request #1127 from mapreal19/fix-mga-zero-decimal-currency
Fix MGA (Malagasy Ariary) to be a zero-decimal currency
2 parents f32ecde + b91c02c commit d203bd9

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Upcoming 7.0.0.alpha
44

55
- **Potential breaking change**: Fix USDC decimals places from 2 to 6
6+
- **Potential breaking change**: Fix MGA (Malagasy Ariary) to be a zero-decimal currency (changing subunit_to_unit from 5 to 1)
67
- Fix typo in ILS currency
78
- Add Caribbean Guilder (XCG) as replacement for Netherlands Antillean Gulden (ANG)
89

config/currency_iso.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,7 @@
13711371
"symbol": "Ar",
13721372
"alternate_symbols": [],
13731373
"subunit": "Iraimbilanja",
1374-
"subunit_to_unit": 5,
1374+
"subunit_to_unit": 1,
13751375
"symbol_first": true,
13761376
"html_entity": "",
13771377
"decimal_mark": ".",

spec/money/formatting_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@
298298
specify "(no_cents_if_whole: true) works as documented" do
299299
expect(Money.new(10000, "VUV").format(no_cents_if_whole: true, symbol: false)).to eq "10,000"
300300
expect(Money.new(10034, "VUV").format(no_cents_if_whole: true, symbol: false)).to eq "10,034"
301-
expect(Money.new(10000, "MGA").format(no_cents_if_whole: true, symbol: false)).to eq "2,000"
302-
expect(Money.new(10034, "MGA").format(no_cents_if_whole: true, symbol: false)).to eq "2,006.8"
301+
expect(Money.new(10000, "MGA").format(no_cents_if_whole: true, symbol: false)).to eq "10,000"
302+
expect(Money.new(10034, "MGA").format(no_cents_if_whole: true, symbol: false)).to eq "10,034"
303303
expect(Money.new(10000, "VND").format(no_cents_if_whole: true, symbol: false)).to eq "10.000"
304304
expect(Money.new(10034, "VND").format(no_cents_if_whole: true, symbol: false)).to eq "10.034"
305305
expect(Money.new(10000, "USD").format(no_cents_if_whole: true, symbol: false)).to eq "100"
@@ -311,8 +311,8 @@
311311
specify "(no_cents_if_whole: false) works as documented" do
312312
expect(Money.new(10000, "VUV").format(no_cents_if_whole: false, symbol: false)).to eq "10,000"
313313
expect(Money.new(10034, "VUV").format(no_cents_if_whole: false, symbol: false)).to eq "10,034"
314-
expect(Money.new(10000, "MGA").format(no_cents_if_whole: false, symbol: false)).to eq "2,000.0"
315-
expect(Money.new(10034, "MGA").format(no_cents_if_whole: false, symbol: false)).to eq "2,006.8"
314+
expect(Money.new(10000, "MGA").format(no_cents_if_whole: false, symbol: false)).to eq "10,000"
315+
expect(Money.new(10034, "MGA").format(no_cents_if_whole: false, symbol: false)).to eq "10,034"
316316
expect(Money.new(10000, "VND").format(no_cents_if_whole: false, symbol: false)).to eq "10.000"
317317
expect(Money.new(10034, "VND").format(no_cents_if_whole: false, symbol: false)).to eq "10.034"
318318
expect(Money.new(10000, "USD").format(no_cents_if_whole: false, symbol: false)).to eq "100.00"
@@ -627,7 +627,7 @@
627627
expect(Money.new(BigDecimal('123.5'), "BHD").format(rounded_infinite_precision: true)).to eq "د.ب0.124"
628628
expect(Money.new(BigDecimal('100.1'), "USD").format(rounded_infinite_precision: true)).to eq "$1.00"
629629
expect(Money.new(BigDecimal('109.5'), "USD").format(rounded_infinite_precision: true)).to eq "$1.10"
630-
expect(Money.new(BigDecimal('1.7'), "MGA").format(rounded_infinite_precision: true)).to eq "Ar0.4"
630+
expect(Money.new(BigDecimal('1.7'), "MGA").format(rounded_infinite_precision: true)).to eq "Ar2.0"
631631
end
632632

633633
it "does not round fractional when set to false" do
@@ -639,7 +639,7 @@
639639
expect(Money.new(BigDecimal('123.5'), "KWD").format(rounded_infinite_precision: false)).to eq "د.ك0.1235"
640640
expect(Money.new(BigDecimal('100.1'), "USD").format(rounded_infinite_precision: false)).to eq "$1.001"
641641
expect(Money.new(BigDecimal('109.5'), "USD").format(rounded_infinite_precision: false)).to eq "$1.095"
642-
expect(Money.new(BigDecimal('1.7'), "MGA").format(rounded_infinite_precision: false)).to eq "Ar0.34"
642+
expect(Money.new(BigDecimal('1.7'), "MGA").format(rounded_infinite_precision: false)).to eq "Ar1.7"
643643
end
644644

645645
describe "with i18n = false" do
@@ -685,7 +685,7 @@
685685
expect(Money.new(BigDecimal('123.5'), "BHD").format(rounded_infinite_precision: true)).to eq "د.ب0,124"
686686
expect(Money.new(BigDecimal('100.1'), "USD").format(rounded_infinite_precision: true)).to eq "$1,00"
687687
expect(Money.new(BigDecimal('109.5'), "USD").format(rounded_infinite_precision: true)).to eq "$1,10"
688-
expect(Money.new(BigDecimal('1'), "MGA").format(rounded_infinite_precision: true)).to eq "Ar0,2"
688+
expect(Money.new(BigDecimal('1'), "MGA").format(rounded_infinite_precision: true)).to eq "Ar1,0"
689689
end
690690
end
691691
end

spec/money_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ def m.amount
538538
end
539539

540540
it "does not work when :subunit_to_unit == 5" do
541-
expect(Money.new(10_00, "MGA").to_s).to eq "200.0"
541+
expect(Money.new(10_00, "MRU").to_s).to eq "200.0"
542542
end
543543

544544
it "respects :decimal_mark" do

0 commit comments

Comments
 (0)