|
298 | 298 | specify "(no_cents_if_whole: true) works as documented" do |
299 | 299 | expect(Money.new(10000, "VUV").format(no_cents_if_whole: true, symbol: false)).to eq "10,000" |
300 | 300 | 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" |
303 | 303 | expect(Money.new(10000, "VND").format(no_cents_if_whole: true, symbol: false)).to eq "10.000" |
304 | 304 | expect(Money.new(10034, "VND").format(no_cents_if_whole: true, symbol: false)).to eq "10.034" |
305 | 305 | expect(Money.new(10000, "USD").format(no_cents_if_whole: true, symbol: false)).to eq "100" |
|
311 | 311 | specify "(no_cents_if_whole: false) works as documented" do |
312 | 312 | expect(Money.new(10000, "VUV").format(no_cents_if_whole: false, symbol: false)).to eq "10,000" |
313 | 313 | 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" |
316 | 316 | expect(Money.new(10000, "VND").format(no_cents_if_whole: false, symbol: false)).to eq "10.000" |
317 | 317 | expect(Money.new(10034, "VND").format(no_cents_if_whole: false, symbol: false)).to eq "10.034" |
318 | 318 | expect(Money.new(10000, "USD").format(no_cents_if_whole: false, symbol: false)).to eq "100.00" |
|
627 | 627 | expect(Money.new(BigDecimal('123.5'), "BHD").format(rounded_infinite_precision: true)).to eq "د.ب0.124" |
628 | 628 | expect(Money.new(BigDecimal('100.1'), "USD").format(rounded_infinite_precision: true)).to eq "$1.00" |
629 | 629 | 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" |
631 | 631 | end |
632 | 632 |
|
633 | 633 | it "does not round fractional when set to false" do |
|
639 | 639 | expect(Money.new(BigDecimal('123.5'), "KWD").format(rounded_infinite_precision: false)).to eq "د.ك0.1235" |
640 | 640 | expect(Money.new(BigDecimal('100.1'), "USD").format(rounded_infinite_precision: false)).to eq "$1.001" |
641 | 641 | 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" |
643 | 643 | end |
644 | 644 |
|
645 | 645 | describe "with i18n = false" do |
|
685 | 685 | expect(Money.new(BigDecimal('123.5'), "BHD").format(rounded_infinite_precision: true)).to eq "د.ب0,124" |
686 | 686 | expect(Money.new(BigDecimal('100.1'), "USD").format(rounded_infinite_precision: true)).to eq "$1,00" |
687 | 687 | 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" |
689 | 689 | end |
690 | 690 | end |
691 | 691 | end |
|
0 commit comments