money 6.11.0 → 6.11.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -52,7 +52,7 @@ class Money
52
52
 
53
53
  def translate_formatting_rules(rules)
54
54
  begin
55
- rules[:symbol] = I18n.t currency.iso_code, :scope => "number.currency.symbol", :raise => true
55
+ rules[:symbol] = I18n.t currency.iso_code, scope: "number.currency.symbol", raise: true
56
56
  rescue I18n::MissingTranslationData
57
57
  # Do nothing
58
58
  end
@@ -1,3 +1,3 @@
1
1
  class Money
2
- VERSION = '6.11.0'
2
+ VERSION = '6.11.1'
3
3
  end
@@ -151,7 +151,7 @@ class Money
151
151
 
152
152
  it "delegates options to store, options are a no-op" do
153
153
  expect(subject.store).to receive(:get_rate).with('USD', 'EUR')
154
- subject.get_rate('USD', 'EUR', :without_mutex => true)
154
+ subject.get_rate('USD', 'EUR', without_mutex: true)
155
155
  end
156
156
  end
157
157
 
@@ -201,7 +201,7 @@ class Money
201
201
 
202
202
  it "delegates execution to store, options are a no-op" do
203
203
  expect(subject.store).to receive(:transaction)
204
- subject.export_rates(:yaml, nil, :foo => 1)
204
+ subject.export_rates(:yaml, nil, foo: 1)
205
205
  end
206
206
 
207
207
  end
@@ -243,7 +243,7 @@ class Money
243
243
  it "delegates execution to store#transaction" do
244
244
  expect(subject.store).to receive(:transaction)
245
245
  s = "--- \nUSD_TO_EUR: 1.25\nUSD_TO_JPY: 2.55\n"
246
- subject.import_rates(:yaml, s, :foo => 1)
246
+ subject.import_rates(:yaml, s, foo: 1)
247
247
  end
248
248
 
249
249
  end
@@ -6,7 +6,7 @@ class Money
6
6
  FOO = '{ "priority": 1, "iso_code": "FOO", "iso_numeric": "840", "name": "United States Dollar", "symbol": "$", "subunit": "Cent", "subunit_to_unit": 1000, "symbol_first": true, "html_entity": "$", "decimal_mark": ".", "thousands_separator": ",", "smallest_denomination": 1 }'
7
7
 
8
8
  def register_foo(opts={})
9
- foo_attrs = JSON.parse(FOO, :symbolize_names => true)
9
+ foo_attrs = JSON.parse(FOO, symbolize_names: true)
10
10
  # Pass an array of attribute names to 'skip' to remove them from the 'FOO'
11
11
  # json before registering foo as a currency.
12
12
  Array(opts[:skip]).each { |attr| foo_attrs.delete(attr) }
@@ -14,7 +14,7 @@ class Money
14
14
  end
15
15
 
16
16
  def unregister_foo
17
- Currency.unregister(JSON.parse(FOO, :symbolize_names => true))
17
+ Currency.unregister(JSON.parse(FOO, symbolize_names: true))
18
18
  end
19
19
 
20
20
  describe "UnknownCurrency" do
@@ -82,7 +82,7 @@ class Money
82
82
  expect(Currency.all.first.priority).to eq 1
83
83
  end
84
84
  it "raises a MissingAttributeError if any currency has no priority" do
85
- register_foo(:skip => :priority)
85
+ register_foo(skip: :priority)
86
86
 
87
87
  expect{Money::Currency.all}.to \
88
88
  raise_error(Money::Currency::MissingAttributeError, /foo.*priority/)
@@ -247,10 +247,10 @@ describe Money do
247
247
  describe "#*" do
248
248
  it "multiplies Money by Integer and returns Money" do
249
249
  ts = [
250
- {:a => Money.new( 10, :USD), :b => 4, :c => Money.new( 40, :USD)},
251
- {:a => Money.new( 10, :USD), :b => -4, :c => Money.new(-40, :USD)},
252
- {:a => Money.new(-10, :USD), :b => 4, :c => Money.new(-40, :USD)},
253
- {:a => Money.new(-10, :USD), :b => -4, :c => Money.new( 40, :USD)},
250
+ {a: Money.new( 10, :USD), b: 4, c: Money.new( 40, :USD)},
251
+ {a: Money.new( 10, :USD), b: -4, c: Money.new(-40, :USD)},
252
+ {a: Money.new(-10, :USD), b: 4, c: Money.new(-40, :USD)},
253
+ {a: Money.new(-10, :USD), b: -4, c: Money.new( 40, :USD)},
254
254
  ]
255
255
  ts.each do |t|
256
256
  expect(t[:a] * t[:b]).to eq t[:c]
@@ -280,10 +280,10 @@ describe Money do
280
280
  describe "#/" do
281
281
  it "divides Money by Integer and returns Money" do
282
282
  ts = [
283
- {:a => Money.new( 13, :USD), :b => 4, :c => Money.new( 3, :USD)},
284
- {:a => Money.new( 13, :USD), :b => -4, :c => Money.new(-3, :USD)},
285
- {:a => Money.new(-13, :USD), :b => 4, :c => Money.new(-3, :USD)},
286
- {:a => Money.new(-13, :USD), :b => -4, :c => Money.new( 3, :USD)},
283
+ {a: Money.new( 13, :USD), b: 4, c: Money.new( 3, :USD)},
284
+ {a: Money.new( 13, :USD), b: -4, c: Money.new(-3, :USD)},
285
+ {a: Money.new(-13, :USD), b: 4, c: Money.new(-3, :USD)},
286
+ {a: Money.new(-13, :USD), b: -4, c: Money.new( 3, :USD)},
287
287
  ]
288
288
  ts.each do |t|
289
289
  expect(t[:a] / t[:b]).to eq t[:c]
@@ -335,10 +335,10 @@ describe Money do
335
335
 
336
336
  it "divides Money by Money (same currency) and returns Float" do
337
337
  ts = [
338
- {:a => Money.new( 13, :USD), :b => Money.new( 4, :USD), :c => 3.25},
339
- {:a => Money.new( 13, :USD), :b => Money.new(-4, :USD), :c => -3.25},
340
- {:a => Money.new(-13, :USD), :b => Money.new( 4, :USD), :c => -3.25},
341
- {:a => Money.new(-13, :USD), :b => Money.new(-4, :USD), :c => 3.25},
338
+ {a: Money.new( 13, :USD), b: Money.new( 4, :USD), c: 3.25},
339
+ {a: Money.new( 13, :USD), b: Money.new(-4, :USD), c: -3.25},
340
+ {a: Money.new(-13, :USD), b: Money.new( 4, :USD), c: -3.25},
341
+ {a: Money.new(-13, :USD), b: Money.new(-4, :USD), c: 3.25},
342
342
  ]
343
343
  ts.each do |t|
344
344
  expect(t[:a] / t[:b]).to eq t[:c]
@@ -347,10 +347,10 @@ describe Money do
347
347
 
348
348
  it "divides Money by Money (different currency) and returns Float" do
349
349
  ts = [
350
- {:a => Money.new( 13, :USD), :b => Money.new( 4, :EUR), :c => 1.625},
351
- {:a => Money.new( 13, :USD), :b => Money.new(-4, :EUR), :c => -1.625},
352
- {:a => Money.new(-13, :USD), :b => Money.new( 4, :EUR), :c => -1.625},
353
- {:a => Money.new(-13, :USD), :b => Money.new(-4, :EUR), :c => 1.625},
350
+ {a: Money.new( 13, :USD), b: Money.new( 4, :EUR), c: 1.625},
351
+ {a: Money.new( 13, :USD), b: Money.new(-4, :EUR), c: -1.625},
352
+ {a: Money.new(-13, :USD), b: Money.new( 4, :EUR), c: -1.625},
353
+ {a: Money.new(-13, :USD), b: Money.new(-4, :EUR), c: 1.625},
354
354
  ]
355
355
  ts.each do |t|
356
356
  expect(t[:b]).to receive(:exchange_to).once.with(t[:a].currency).and_return(Money.new(t[:b].cents * 2, :USD))
@@ -361,10 +361,10 @@ describe Money do
361
361
  context "with infinite_precision", :infinite_precision do
362
362
  it "uses BigDecimal division" do
363
363
  ts = [
364
- {:a => Money.new( 13, :USD), :b => 4, :c => Money.new( 3.25, :USD)},
365
- {:a => Money.new( 13, :USD), :b => -4, :c => Money.new(-3.25, :USD)},
366
- {:a => Money.new(-13, :USD), :b => 4, :c => Money.new(-3.25, :USD)},
367
- {:a => Money.new(-13, :USD), :b => -4, :c => Money.new( 3.25, :USD)},
364
+ {a: Money.new( 13, :USD), b: 4, c: Money.new( 3.25, :USD)},
365
+ {a: Money.new( 13, :USD), b: -4, c: Money.new(-3.25, :USD)},
366
+ {a: Money.new(-13, :USD), b: 4, c: Money.new(-3.25, :USD)},
367
+ {a: Money.new(-13, :USD), b: -4, c: Money.new( 3.25, :USD)},
368
368
  ]
369
369
  ts.each do |t|
370
370
  expect(t[:a] / t[:b]).to eq t[:c]
@@ -378,10 +378,10 @@ describe Money do
378
378
  describe "#div" do
379
379
  it "divides Money by Integer and returns Money" do
380
380
  ts = [
381
- {:a => Money.new( 13, :USD), :b => 4, :c => Money.new( 3, :USD)},
382
- {:a => Money.new( 13, :USD), :b => -4, :c => Money.new(-3, :USD)},
383
- {:a => Money.new(-13, :USD), :b => 4, :c => Money.new(-3, :USD)},
384
- {:a => Money.new(-13, :USD), :b => -4, :c => Money.new( 3, :USD)},
381
+ {a: Money.new( 13, :USD), b: 4, c: Money.new( 3, :USD)},
382
+ {a: Money.new( 13, :USD), b: -4, c: Money.new(-3, :USD)},
383
+ {a: Money.new(-13, :USD), b: 4, c: Money.new(-3, :USD)},
384
+ {a: Money.new(-13, :USD), b: -4, c: Money.new( 3, :USD)},
385
385
  ]
386
386
  ts.each do |t|
387
387
  expect(t[:a].div(t[:b])).to eq t[:c]
@@ -390,10 +390,10 @@ describe Money do
390
390
 
391
391
  it "divides Money by Money (same currency) and returns Float" do
392
392
  ts = [
393
- {:a => Money.new( 13, :USD), :b => Money.new( 4, :USD), :c => 3.25},
394
- {:a => Money.new( 13, :USD), :b => Money.new(-4, :USD), :c => -3.25},
395
- {:a => Money.new(-13, :USD), :b => Money.new( 4, :USD), :c => -3.25},
396
- {:a => Money.new(-13, :USD), :b => Money.new(-4, :USD), :c => 3.25},
393
+ {a: Money.new( 13, :USD), b: Money.new( 4, :USD), c: 3.25},
394
+ {a: Money.new( 13, :USD), b: Money.new(-4, :USD), c: -3.25},
395
+ {a: Money.new(-13, :USD), b: Money.new( 4, :USD), c: -3.25},
396
+ {a: Money.new(-13, :USD), b: Money.new(-4, :USD), c: 3.25},
397
397
  ]
398
398
  ts.each do |t|
399
399
  expect(t[:a].div(t[:b])).to eq t[:c]
@@ -402,10 +402,10 @@ describe Money do
402
402
 
403
403
  it "divides Money by Money (different currency) and returns Float" do
404
404
  ts = [
405
- {:a => Money.new( 13, :USD), :b => Money.new( 4, :EUR), :c => 1.625},
406
- {:a => Money.new( 13, :USD), :b => Money.new(-4, :EUR), :c => -1.625},
407
- {:a => Money.new(-13, :USD), :b => Money.new( 4, :EUR), :c => -1.625},
408
- {:a => Money.new(-13, :USD), :b => Money.new(-4, :EUR), :c => 1.625},
405
+ {a: Money.new( 13, :USD), b: Money.new( 4, :EUR), c: 1.625},
406
+ {a: Money.new( 13, :USD), b: Money.new(-4, :EUR), c: -1.625},
407
+ {a: Money.new(-13, :USD), b: Money.new( 4, :EUR), c: -1.625},
408
+ {a: Money.new(-13, :USD), b: Money.new(-4, :EUR), c: 1.625},
409
409
  ]
410
410
  ts.each do |t|
411
411
  expect(t[:b]).to receive(:exchange_to).once.with(t[:a].currency).and_return(Money.new(t[:b].cents * 2, :USD))
@@ -416,10 +416,10 @@ describe Money do
416
416
  context "with infinite_precision", :infinite_precision do
417
417
  it "uses BigDecimal division" do
418
418
  ts = [
419
- {:a => Money.new( 13, :USD), :b => 4, :c => Money.new( 3.25, :USD)},
420
- {:a => Money.new( 13, :USD), :b => -4, :c => Money.new(-3.25, :USD)},
421
- {:a => Money.new(-13, :USD), :b => 4, :c => Money.new(-3.25, :USD)},
422
- {:a => Money.new(-13, :USD), :b => -4, :c => Money.new( 3.25, :USD)},
419
+ {a: Money.new( 13, :USD), b: 4, c: Money.new( 3.25, :USD)},
420
+ {a: Money.new( 13, :USD), b: -4, c: Money.new(-3.25, :USD)},
421
+ {a: Money.new(-13, :USD), b: 4, c: Money.new(-3.25, :USD)},
422
+ {a: Money.new(-13, :USD), b: -4, c: Money.new( 3.25, :USD)},
423
423
  ]
424
424
  ts.each do |t|
425
425
  expect(t[:a].div(t[:b])).to eq t[:c]
@@ -431,10 +431,10 @@ describe Money do
431
431
  describe "#divmod" do
432
432
  it "calculates division and modulo with Integer" do
433
433
  ts = [
434
- {:a => Money.new( 13, :USD), :b => 4, :c => [Money.new( 3, :USD), Money.new( 1, :USD)]},
435
- {:a => Money.new( 13, :USD), :b => -4, :c => [Money.new(-4, :USD), Money.new(-3, :USD)]},
436
- {:a => Money.new(-13, :USD), :b => 4, :c => [Money.new(-4, :USD), Money.new( 3, :USD)]},
437
- {:a => Money.new(-13, :USD), :b => -4, :c => [Money.new( 3, :USD), Money.new(-1, :USD)]},
434
+ {a: Money.new( 13, :USD), b: 4, c: [Money.new( 3, :USD), Money.new( 1, :USD)]},
435
+ {a: Money.new( 13, :USD), b: -4, c: [Money.new(-4, :USD), Money.new(-3, :USD)]},
436
+ {a: Money.new(-13, :USD), b: 4, c: [Money.new(-4, :USD), Money.new( 3, :USD)]},
437
+ {a: Money.new(-13, :USD), b: -4, c: [Money.new( 3, :USD), Money.new(-1, :USD)]},
438
438
  ]
439
439
  ts.each do |t|
440
440
  expect(t[:a].divmod(t[:b])).to eq t[:c]
@@ -443,10 +443,10 @@ describe Money do
443
443
 
444
444
  it "calculates division and modulo with Money (same currency)" do
445
445
  ts = [
446
- {:a => Money.new( 13, :USD), :b => Money.new( 4, :USD), :c => [ 3, Money.new( 1, :USD)]},
447
- {:a => Money.new( 13, :USD), :b => Money.new(-4, :USD), :c => [-4, Money.new(-3, :USD)]},
448
- {:a => Money.new(-13, :USD), :b => Money.new( 4, :USD), :c => [-4, Money.new( 3, :USD)]},
449
- {:a => Money.new(-13, :USD), :b => Money.new(-4, :USD), :c => [ 3, Money.new(-1, :USD)]},
446
+ {a: Money.new( 13, :USD), b: Money.new( 4, :USD), c: [ 3, Money.new( 1, :USD)]},
447
+ {a: Money.new( 13, :USD), b: Money.new(-4, :USD), c: [-4, Money.new(-3, :USD)]},
448
+ {a: Money.new(-13, :USD), b: Money.new( 4, :USD), c: [-4, Money.new( 3, :USD)]},
449
+ {a: Money.new(-13, :USD), b: Money.new(-4, :USD), c: [ 3, Money.new(-1, :USD)]},
450
450
  ]
451
451
  ts.each do |t|
452
452
  expect(t[:a].divmod(t[:b])).to eq t[:c]
@@ -455,10 +455,10 @@ describe Money do
455
455
 
456
456
  it "calculates division and modulo with Money (different currency)" do
457
457
  ts = [
458
- {:a => Money.new( 13, :USD), :b => Money.new( 4, :EUR), :c => [ 1, Money.new( 5, :USD)]},
459
- {:a => Money.new( 13, :USD), :b => Money.new(-4, :EUR), :c => [-2, Money.new(-3, :USD)]},
460
- {:a => Money.new(-13, :USD), :b => Money.new( 4, :EUR), :c => [-2, Money.new( 3, :USD)]},
461
- {:a => Money.new(-13, :USD), :b => Money.new(-4, :EUR), :c => [ 1, Money.new(-5, :USD)]},
458
+ {a: Money.new( 13, :USD), b: Money.new( 4, :EUR), c: [ 1, Money.new( 5, :USD)]},
459
+ {a: Money.new( 13, :USD), b: Money.new(-4, :EUR), c: [-2, Money.new(-3, :USD)]},
460
+ {a: Money.new(-13, :USD), b: Money.new( 4, :EUR), c: [-2, Money.new( 3, :USD)]},
461
+ {a: Money.new(-13, :USD), b: Money.new(-4, :EUR), c: [ 1, Money.new(-5, :USD)]},
462
462
  ]
463
463
  ts.each do |t|
464
464
  expect(t[:b]).to receive(:exchange_to).once.with(t[:a].currency).and_return(Money.new(t[:b].cents * 2, :USD))
@@ -469,10 +469,10 @@ describe Money do
469
469
  context "with infinite_precision", :infinite_precision do
470
470
  it "uses BigDecimal division" do
471
471
  ts = [
472
- {:a => Money.new( 13, :USD), :b => 4, :c => [Money.new( 3, :USD), Money.new( 1, :USD)]},
473
- {:a => Money.new( 13, :USD), :b => -4, :c => [Money.new(-4, :USD), Money.new(-3, :USD)]},
474
- {:a => Money.new(-13, :USD), :b => 4, :c => [Money.new(-4, :USD), Money.new( 3, :USD)]},
475
- {:a => Money.new(-13, :USD), :b => -4, :c => [Money.new( 3, :USD), Money.new(-1, :USD)]},
472
+ {a: Money.new( 13, :USD), b: 4, c: [Money.new( 3, :USD), Money.new( 1, :USD)]},
473
+ {a: Money.new( 13, :USD), b: -4, c: [Money.new(-4, :USD), Money.new(-3, :USD)]},
474
+ {a: Money.new(-13, :USD), b: 4, c: [Money.new(-4, :USD), Money.new( 3, :USD)]},
475
+ {a: Money.new(-13, :USD), b: -4, c: [Money.new( 3, :USD), Money.new(-1, :USD)]},
476
476
  ]
477
477
  ts.each do |t|
478
478
  expect(t[:a].divmod(t[:b])).to eq t[:c]
@@ -497,10 +497,10 @@ describe Money do
497
497
  describe "#modulo" do
498
498
  it "calculates modulo with Integer" do
499
499
  ts = [
500
- {:a => Money.new( 13, :USD), :b => 4, :c => Money.new( 1, :USD)},
501
- {:a => Money.new( 13, :USD), :b => -4, :c => Money.new(-3, :USD)},
502
- {:a => Money.new(-13, :USD), :b => 4, :c => Money.new( 3, :USD)},
503
- {:a => Money.new(-13, :USD), :b => -4, :c => Money.new(-1, :USD)},
500
+ {a: Money.new( 13, :USD), b: 4, c: Money.new( 1, :USD)},
501
+ {a: Money.new( 13, :USD), b: -4, c: Money.new(-3, :USD)},
502
+ {a: Money.new(-13, :USD), b: 4, c: Money.new( 3, :USD)},
503
+ {a: Money.new(-13, :USD), b: -4, c: Money.new(-1, :USD)},
504
504
  ]
505
505
  ts.each do |t|
506
506
  expect(t[:a].modulo(t[:b])).to eq t[:c]
@@ -509,10 +509,10 @@ describe Money do
509
509
 
510
510
  it "calculates modulo with Money (same currency)" do
511
511
  ts = [
512
- {:a => Money.new( 13, :USD), :b => Money.new( 4, :USD), :c => Money.new( 1, :USD)},
513
- {:a => Money.new( 13, :USD), :b => Money.new(-4, :USD), :c => Money.new(-3, :USD)},
514
- {:a => Money.new(-13, :USD), :b => Money.new( 4, :USD), :c => Money.new( 3, :USD)},
515
- {:a => Money.new(-13, :USD), :b => Money.new(-4, :USD), :c => Money.new(-1, :USD)},
512
+ {a: Money.new( 13, :USD), b: Money.new( 4, :USD), c: Money.new( 1, :USD)},
513
+ {a: Money.new( 13, :USD), b: Money.new(-4, :USD), c: Money.new(-3, :USD)},
514
+ {a: Money.new(-13, :USD), b: Money.new( 4, :USD), c: Money.new( 3, :USD)},
515
+ {a: Money.new(-13, :USD), b: Money.new(-4, :USD), c: Money.new(-1, :USD)},
516
516
  ]
517
517
  ts.each do |t|
518
518
  expect(t[:a].modulo(t[:b])).to eq t[:c]
@@ -521,10 +521,10 @@ describe Money do
521
521
 
522
522
  it "calculates modulo with Money (different currency)" do
523
523
  ts = [
524
- {:a => Money.new( 13, :USD), :b => Money.new( 4, :EUR), :c => Money.new( 5, :USD)},
525
- {:a => Money.new( 13, :USD), :b => Money.new(-4, :EUR), :c => Money.new(-3, :USD)},
526
- {:a => Money.new(-13, :USD), :b => Money.new( 4, :EUR), :c => Money.new( 3, :USD)},
527
- {:a => Money.new(-13, :USD), :b => Money.new(-4, :EUR), :c => Money.new(-5, :USD)},
524
+ {a: Money.new( 13, :USD), b: Money.new( 4, :EUR), c: Money.new( 5, :USD)},
525
+ {a: Money.new( 13, :USD), b: Money.new(-4, :EUR), c: Money.new(-3, :USD)},
526
+ {a: Money.new(-13, :USD), b: Money.new( 4, :EUR), c: Money.new( 3, :USD)},
527
+ {a: Money.new(-13, :USD), b: Money.new(-4, :EUR), c: Money.new(-5, :USD)},
528
528
  ]
529
529
  ts.each do |t|
530
530
  expect(t[:b]).to receive(:exchange_to).once.with(t[:a].currency).and_return(Money.new(t[:b].cents * 2, :USD))
@@ -536,10 +536,10 @@ describe Money do
536
536
  describe "#%" do
537
537
  it "calculates modulo with Integer" do
538
538
  ts = [
539
- {:a => Money.new( 13, :USD), :b => 4, :c => Money.new( 1, :USD)},
540
- {:a => Money.new( 13, :USD), :b => -4, :c => Money.new(-3, :USD)},
541
- {:a => Money.new(-13, :USD), :b => 4, :c => Money.new( 3, :USD)},
542
- {:a => Money.new(-13, :USD), :b => -4, :c => Money.new(-1, :USD)},
539
+ {a: Money.new( 13, :USD), b: 4, c: Money.new( 1, :USD)},
540
+ {a: Money.new( 13, :USD), b: -4, c: Money.new(-3, :USD)},
541
+ {a: Money.new(-13, :USD), b: 4, c: Money.new( 3, :USD)},
542
+ {a: Money.new(-13, :USD), b: -4, c: Money.new(-1, :USD)},
543
543
  ]
544
544
  ts.each do |t|
545
545
  expect(t[:a] % t[:b]).to eq t[:c]
@@ -548,10 +548,10 @@ describe Money do
548
548
 
549
549
  it "calculates modulo with Money (same currency)" do
550
550
  ts = [
551
- {:a => Money.new( 13, :USD), :b => Money.new( 4, :USD), :c => Money.new( 1, :USD)},
552
- {:a => Money.new( 13, :USD), :b => Money.new(-4, :USD), :c => Money.new(-3, :USD)},
553
- {:a => Money.new(-13, :USD), :b => Money.new( 4, :USD), :c => Money.new( 3, :USD)},
554
- {:a => Money.new(-13, :USD), :b => Money.new(-4, :USD), :c => Money.new(-1, :USD)},
551
+ {a: Money.new( 13, :USD), b: Money.new( 4, :USD), c: Money.new( 1, :USD)},
552
+ {a: Money.new( 13, :USD), b: Money.new(-4, :USD), c: Money.new(-3, :USD)},
553
+ {a: Money.new(-13, :USD), b: Money.new( 4, :USD), c: Money.new( 3, :USD)},
554
+ {a: Money.new(-13, :USD), b: Money.new(-4, :USD), c: Money.new(-1, :USD)},
555
555
  ]
556
556
  ts.each do |t|
557
557
  expect(t[:a] % t[:b]).to eq t[:c]
@@ -560,10 +560,10 @@ describe Money do
560
560
 
561
561
  it "calculates modulo with Money (different currency)" do
562
562
  ts = [
563
- {:a => Money.new( 13, :USD), :b => Money.new( 4, :EUR), :c => Money.new( 5, :USD)},
564
- {:a => Money.new( 13, :USD), :b => Money.new(-4, :EUR), :c => Money.new(-3, :USD)},
565
- {:a => Money.new(-13, :USD), :b => Money.new( 4, :EUR), :c => Money.new( 3, :USD)},
566
- {:a => Money.new(-13, :USD), :b => Money.new(-4, :EUR), :c => Money.new(-5, :USD)},
563
+ {a: Money.new( 13, :USD), b: Money.new( 4, :EUR), c: Money.new( 5, :USD)},
564
+ {a: Money.new( 13, :USD), b: Money.new(-4, :EUR), c: Money.new(-3, :USD)},
565
+ {a: Money.new(-13, :USD), b: Money.new( 4, :EUR), c: Money.new( 3, :USD)},
566
+ {a: Money.new(-13, :USD), b: Money.new(-4, :EUR), c: Money.new(-5, :USD)},
567
567
  ]
568
568
  ts.each do |t|
569
569
  expect(t[:b]).to receive(:exchange_to).once.with(t[:a].currency).and_return(Money.new(t[:b].cents * 2, :USD))
@@ -575,10 +575,10 @@ describe Money do
575
575
  describe "#remainder" do
576
576
  it "calculates remainder with Integer" do
577
577
  ts = [
578
- {:a => Money.new( 13, :USD), :b => 4, :c => Money.new( 1, :USD)},
579
- {:a => Money.new( 13, :USD), :b => -4, :c => Money.new( 1, :USD)},
580
- {:a => Money.new(-13, :USD), :b => 4, :c => Money.new(-1, :USD)},
581
- {:a => Money.new(-13, :USD), :b => -4, :c => Money.new(-1, :USD)},
578
+ {a: Money.new( 13, :USD), b: 4, c: Money.new( 1, :USD)},
579
+ {a: Money.new( 13, :USD), b: -4, c: Money.new( 1, :USD)},
580
+ {a: Money.new(-13, :USD), b: 4, c: Money.new(-1, :USD)},
581
+ {a: Money.new(-13, :USD), b: -4, c: Money.new(-1, :USD)},
582
582
  ]
583
583
  ts.each do |t|
584
584
  expect(t[:a].remainder(t[:b])).to eq t[:c]
@@ -631,6 +631,11 @@ describe Money do
631
631
  end
632
632
 
633
633
  describe "#coerce" do
634
+ it 'allows non-default currency money objects to be summed' do
635
+ result = 0 + Money.new(4, 'EUR') + Money.new(5, 'EUR')
636
+ expect(result).to eq Money.new(9, 'EUR')
637
+ end
638
+
634
639
  it "allows mathematical operations by coercing arguments" do
635
640
  result = 2 * Money.new(4, 'USD')
636
641
  expect(result).to eq Money.new(8, 'USD')
@@ -24,7 +24,7 @@ describe Money, "formatting" do
24
24
  I18n.locale = :de
25
25
  I18n.backend.store_translations(
26
26
  :de,
27
- :number => { :currency => { :format => { :delimiter => ".", :separator => "," } } }
27
+ number: { currency: { format: { delimiter: ".", separator: "," } } }
28
28
  )
29
29
  Money.use_i18n = false
30
30
  end
@@ -58,7 +58,7 @@ describe Money, "formatting" do
58
58
  I18n.locale = :de
59
59
  I18n.backend.store_translations(
60
60
  :de,
61
- :number => { :format => { :delimiter => ".", :separator => "," } }
61
+ number: { format: { delimiter: ".", separator: "," } }
62
62
  )
63
63
  end
64
64
 
@@ -79,7 +79,7 @@ describe Money, "formatting" do
79
79
  I18n.locale = :de
80
80
  I18n.backend.store_translations(
81
81
  :de,
82
- :number => { :currency => { :format => { :delimiter => ".", :separator => "," } } }
82
+ number: { currency: { format: { delimiter: ".", separator: "," } } }
83
83
  )
84
84
  end
85
85
 
@@ -100,24 +100,24 @@ describe Money, "formatting" do
100
100
  I18n.locale = :de
101
101
  I18n.backend.store_translations(
102
102
  :de,
103
- :number => { :currency => { :symbol => { :CAD => "CAD$" } } }
103
+ number: { currency: { symbol: { CAD: "CAD$" } } }
104
104
  )
105
105
  end
106
106
 
107
107
  subject(:money) { Money.empty("CAD") }
108
108
 
109
109
  it "should use 'CAD$' as the currency symbol" do
110
- expect(money.format(:translate => true)).to eq("CAD$0.00")
110
+ expect(money.format(translate: true)).to eq("CAD$0.00")
111
111
  end
112
112
  end
113
113
 
114
114
  context "with overridden i18n settings" do
115
115
  it "should respect explicit overriding of thousands_separator/delimiter when decimal_mark/separator collide and there’s no decimal component for currencies that have no subunit" do
116
- expect(Money.new(300_000, 'ISK').format(:thousands_separator => ".", decimal_mark: ',')).to eq "kr300.000"
116
+ expect(Money.new(300_000, 'ISK').format(thousands_separator: ".", decimal_mark: ',')).to eq "kr300.000"
117
117
  end
118
118
 
119
119
  it "should respect explicit overriding of thousands_separator/delimiter when decimal_mark/separator collide and there’s no decimal component for currencies with subunits that drop_trailing_zeros" do
120
- expect(Money.new(300_000, 'USD').format(:thousands_separator => ".", decimal_mark: ',', drop_trailing_zeros: true)).to eq "$3.000"
120
+ expect(Money.new(300_000, 'USD').format(thousands_separator: ".", decimal_mark: ',', drop_trailing_zeros: true)).to eq "$3.000"
121
121
  end
122
122
  end
123
123
  end
@@ -129,7 +129,7 @@ describe Money, "formatting" do
129
129
  it "formats Japanese currency in Japanese properly" do
130
130
  money = Money.new(1000, "JPY")
131
131
  expect(money.format).to eq "1,000円"
132
- expect(money.format(:symbol => false)).to eq "1,000"
132
+ expect(money.format(symbol: false)).to eq "1,000"
133
133
  end
134
134
 
135
135
  after { I18n.locale = @_locale }
@@ -144,8 +144,18 @@ describe Money, "formatting" do
144
144
  expect(Money.new(10_00, "BHD").format).to eq "ب.د1.000"
145
145
  end
146
146
 
147
- it "does not display a decimal when :subunit_to_unit is 1" do
148
- expect(Money.new(10_00, "VUV").format).to eq "Vt1,000"
147
+ context "when :subunit_to_unit is 1" do
148
+ it "does not display a decimal part" do
149
+ expect(Money.new(10_00, "VUV").format).to eq "Vt1,000"
150
+ end
151
+
152
+ it "does not displays a decimal part when infinite_precision is false" do
153
+ expect(Money.new(10_00.1, "VUV").format).to eq "Vt1,000"
154
+ end
155
+
156
+ it "displays a decimal part when infinite_precision is true", :infinite_precision do
157
+ expect(Money.new(10_00.1, "VUV").format).to eq "Vt1,000.1"
158
+ end
149
159
  end
150
160
 
151
161
  it "respects the thousands_separator and decimal_mark defaults" do
@@ -186,17 +196,17 @@ describe Money, "formatting" do
186
196
 
187
197
  it "inserts commas into the result if the amount is sufficiently large" do
188
198
  expect(Money.us_dollar(1_000_000_000_12).format).to eq "$1,000,000,000.12"
189
- expect(Money.us_dollar(1_000_000_000_12).format(:no_cents => true)).to eq "$1,000,000,000"
199
+ expect(Money.us_dollar(1_000_000_000_12).format(no_cents: true)).to eq "$1,000,000,000"
190
200
  end
191
201
 
192
202
  it "inserts thousands separator into the result if the amount is sufficiently large and the currency symbol is at the end" do
193
203
  expect(Money.euro(1_234_567_12).format).to eq "€1.234.567,12"
194
- expect(Money.euro(1_234_567_12).format(:no_cents => true)).to eq "€1.234.567"
204
+ expect(Money.euro(1_234_567_12).format(no_cents: true)).to eq "€1.234.567"
195
205
  end
196
206
 
197
207
  context 'when default_formatting_rules defines (display_free: true)' do
198
208
  before do
199
- Money.default_formatting_rules = { :display_free => "you won't pay a thing" }
209
+ Money.default_formatting_rules = { display_free: "you won't pay a thing" }
200
210
  end
201
211
 
202
212
  after do
@@ -211,7 +221,7 @@ describe Money, "formatting" do
211
221
 
212
222
  context 'with rule (display_free: false) provided' do
213
223
  it 'acknowledges provided rule' do
214
- expect(Money.new(0, 'USD').format(:display_free => false)).to eq '$0.00'
224
+ expect(Money.new(0, 'USD').format(display_free: false)).to eq '$0.00'
215
225
  end
216
226
  end
217
227
  end
@@ -223,79 +233,79 @@ describe Money, "formatting" do
223
233
 
224
234
  context 'acknowledges provided rule' do
225
235
  it 'acknowledges provided rule' do
226
- expect(Money.new(100, 'USD').format(:with_currency => true)).to eq '$1.00 USD'
236
+ expect(Money.new(100, 'USD').format(with_currency: true)).to eq '$1.00 USD'
227
237
  end
228
238
  end
229
239
  end
230
240
 
231
241
  describe ":with_currency option" do
232
242
  specify "(:with_currency option => true) works as documented" do
233
- expect(Money.ca_dollar(100).format(:with_currency => true)).to eq "$1.00 CAD"
234
- expect(Money.us_dollar(85).format(:with_currency => true)).to eq "$0.85 USD"
243
+ expect(Money.ca_dollar(100).format(with_currency: true)).to eq "$1.00 CAD"
244
+ expect(Money.us_dollar(85).format(with_currency: true)).to eq "$0.85 USD"
235
245
  end
236
246
  end
237
247
 
238
248
  describe ":no_cents option" do
239
249
  specify "(:with_currency option => true) works as documented" do
240
- expect(Money.ca_dollar(100).format(:no_cents => true)).to eq "$1"
241
- expect(Money.ca_dollar(599).format(:no_cents => true)).to eq "$5"
242
- expect(Money.ca_dollar(570).format(:no_cents => true, :with_currency => true)).to eq "$5 CAD"
243
- expect(Money.ca_dollar(39000).format(:no_cents => true)).to eq "$390"
250
+ expect(Money.ca_dollar(100).format(no_cents: true)).to eq "$1"
251
+ expect(Money.ca_dollar(599).format(no_cents: true)).to eq "$5"
252
+ expect(Money.ca_dollar(570).format(no_cents: true, with_currency: true)).to eq "$5 CAD"
253
+ expect(Money.ca_dollar(39000).format(no_cents: true)).to eq "$390"
244
254
  end
245
255
 
246
256
  it "respects :subunit_to_unit currency property" do
247
- expect(Money.new(10_00, "BHD").format(:no_cents => true)).to eq "ب.د1"
257
+ expect(Money.new(10_00, "BHD").format(no_cents: true)).to eq "ب.د1"
248
258
  end
249
259
 
250
260
  it "inserts thousand separators if symbol contains decimal mark and no_cents is true" do
251
- expect(Money.new(100000000, "AMD").format(:no_cents => true)).to eq "1,000,000 դր."
252
- expect(Money.new(100000000, "USD").format(:no_cents => true)).to eq "$1,000,000"
253
- expect(Money.new(100000000, "RUB").format(:no_cents => true)).to eq "1.000.000 ₽"
261
+ expect(Money.new(100000000, "AMD").format(no_cents: true)).to eq "1,000,000 դր."
262
+ expect(Money.new(100000000, "USD").format(no_cents: true)).to eq "$1,000,000"
263
+ expect(Money.new(100000000, "RUB").format(no_cents: true)).to eq "1.000.000 ₽"
254
264
  end
255
265
 
256
266
  it "doesn't incorrectly format HTML" do
257
267
  money = ::Money.new(1999, "RUB")
258
- output = money.format(:html => true, :no_cents => true)
268
+ output = money.format(html: true, no_cents: true)
259
269
  expect(output).to eq "19 ₽"
260
270
  end
261
271
  end
262
272
 
263
273
  describe ":no_cents_if_whole option" do
264
- specify "(:no_cents_if_whole => true) works as documented" do
265
- expect(Money.new(10000, "VUV").format(:no_cents_if_whole => true, :symbol => false)).to eq "10,000"
266
- expect(Money.new(10034, "VUV").format(:no_cents_if_whole => true, :symbol => false)).to eq "10,034"
267
- expect(Money.new(10000, "MGA").format(:no_cents_if_whole => true, :symbol => false)).to eq "2,000"
268
- expect(Money.new(10034, "MGA").format(:no_cents_if_whole => true, :symbol => false)).to eq "2,006.8"
269
- expect(Money.new(10000, "VND").format(:no_cents_if_whole => true, :symbol => false)).to eq "10.000"
270
- expect(Money.new(10034, "VND").format(:no_cents_if_whole => true, :symbol => false)).to eq "10.034"
271
- expect(Money.new(10000, "USD").format(:no_cents_if_whole => true, :symbol => false)).to eq "100"
272
- expect(Money.new(10034, "USD").format(:no_cents_if_whole => true, :symbol => false)).to eq "100.34"
273
- expect(Money.new(10000, "IQD").format(:no_cents_if_whole => true, :symbol => false)).to eq "10"
274
- expect(Money.new(10034, "IQD").format(:no_cents_if_whole => true, :symbol => false)).to eq "10.034"
275
- end
276
-
277
- specify "(:no_cents_if_whole => false) works as documented" do
278
- expect(Money.new(10000, "VUV").format(:no_cents_if_whole => false, :symbol => false)).to eq "10,000"
279
- expect(Money.new(10034, "VUV").format(:no_cents_if_whole => false, :symbol => false)).to eq "10,034"
280
- expect(Money.new(10000, "MGA").format(:no_cents_if_whole => false, :symbol => false)).to eq "2,000.0"
281
- expect(Money.new(10034, "MGA").format(:no_cents_if_whole => false, :symbol => false)).to eq "2,006.8"
282
- expect(Money.new(10000, "VND").format(:no_cents_if_whole => false, :symbol => false)).to eq "10.000"
283
- expect(Money.new(10034, "VND").format(:no_cents_if_whole => false, :symbol => false)).to eq "10.034"
284
- expect(Money.new(10000, "USD").format(:no_cents_if_whole => false, :symbol => false)).to eq "100.00"
285
- expect(Money.new(10034, "USD").format(:no_cents_if_whole => false, :symbol => false)).to eq "100.34"
286
- expect(Money.new(10000, "IQD").format(:no_cents_if_whole => false, :symbol => false)).to eq "10.000"
287
- expect(Money.new(10034, "IQD").format(:no_cents_if_whole => false, :symbol => false)).to eq "10.034"
274
+ specify "(no_cents_if_whole: true) works as documented" do
275
+ expect(Money.new(10000, "VUV").format(no_cents_if_whole: true, symbol: false)).to eq "10,000"
276
+ expect(Money.new(10034, "VUV").format(no_cents_if_whole: true, symbol: false)).to eq "10,034"
277
+ expect(Money.new(10000, "MGA").format(no_cents_if_whole: true, symbol: false)).to eq "2,000"
278
+ expect(Money.new(10034, "MGA").format(no_cents_if_whole: true, symbol: false)).to eq "2,006.8"
279
+ expect(Money.new(10000, "VND").format(no_cents_if_whole: true, symbol: false)).to eq "10.000"
280
+ expect(Money.new(10034, "VND").format(no_cents_if_whole: true, symbol: false)).to eq "10.034"
281
+ expect(Money.new(10000, "USD").format(no_cents_if_whole: true, symbol: false)).to eq "100"
282
+ expect(Money.new(10034, "USD").format(no_cents_if_whole: true, symbol: false)).to eq "100.34"
283
+ expect(Money.new(10000, "IQD").format(no_cents_if_whole: true, symbol: false)).to eq "10"
284
+ expect(Money.new(10034, "IQD").format(no_cents_if_whole: true, symbol: false)).to eq "10.034"
285
+ end
286
+
287
+ specify "(no_cents_if_whole: false) works as documented" do
288
+ expect(Money.new(10000, "VUV").format(no_cents_if_whole: false, symbol: false)).to eq "10,000"
289
+ expect(Money.new(10034, "VUV").format(no_cents_if_whole: false, symbol: false)).to eq "10,034"
290
+ expect(Money.new(10000, "MGA").format(no_cents_if_whole: false, symbol: false)).to eq "2,000.0"
291
+ expect(Money.new(10034, "MGA").format(no_cents_if_whole: false, symbol: false)).to eq "2,006.8"
292
+ expect(Money.new(10000, "VND").format(no_cents_if_whole: false, symbol: false)).to eq "10.000"
293
+ expect(Money.new(10034, "VND").format(no_cents_if_whole: false, symbol: false)).to eq "10.034"
294
+ expect(Money.new(10000, "USD").format(no_cents_if_whole: false, symbol: false)).to eq "100.00"
295
+ expect(Money.new(10034, "USD").format(no_cents_if_whole: false, symbol: false)).to eq "100.34"
296
+ expect(Money.new(10000, "IQD").format(no_cents_if_whole: false, symbol: false)).to eq "10.000"
297
+ expect(Money.new(10034, "IQD").format(no_cents_if_whole: false, symbol: false)).to eq "10.034"
288
298
  end
289
299
  end
290
300
 
291
301
  describe ":symbol option" do
292
- specify "(:symbol => a symbol string) uses the given value as the money symbol" do
293
- expect(Money.new(100, "GBP").format(:symbol => "£")).to eq "£1.00"
302
+ specify "(symbol: a symbol string) uses the given value as the money symbol" do
303
+ expect(Money.new(100, "GBP").format(symbol: "£")).to eq "£1.00"
294
304
  end
295
305
 
296
- specify "(:symbol => true) returns symbol based on the given currency code" do
306
+ specify "(symbol: true) returns symbol based on the given currency code" do
297
307
  one = Proc.new do |currency|
298
- Money.new(100, currency).format(:symbol => true)
308
+ Money.new(100, currency).format(symbol: true)
299
309
  end
300
310
 
301
311
  # Pounds
@@ -332,26 +342,26 @@ describe Money, "formatting" do
332
342
  expect(one["GHC"]).to eq "₵1.00"
333
343
  end
334
344
 
335
- specify "(:symbol => true) returns $ when currency code is not recognized" do
345
+ specify "(symbol: true) returns $ when currency code is not recognized" do
336
346
  currency = Money::Currency.new("EUR")
337
347
  expect(currency).to receive(:symbol).and_return(nil)
338
- expect(Money.new(100, currency).format(:symbol => true)).to eq "¤1,00"
348
+ expect(Money.new(100, currency).format(symbol: true)).to eq "¤1,00"
339
349
  end
340
350
 
341
- specify "(:symbol => some non-Boolean value that evaluates to true) returns symbol based on the given currency code" do
342
- expect(Money.new(100, "GBP").format(:symbol => true)).to eq "£1.00"
343
- expect(Money.new(100, "EUR").format(:symbol => true)).to eq "€1,00"
344
- expect(Money.new(100, "SEK").format(:symbol => true)).to eq "1,00 kr"
351
+ specify "(symbol: some non-Boolean value that evaluates to true) returns symbol based on the given currency code" do
352
+ expect(Money.new(100, "GBP").format(symbol: true)).to eq "£1.00"
353
+ expect(Money.new(100, "EUR").format(symbol: true)).to eq "€1,00"
354
+ expect(Money.new(100, "SEK").format(symbol: true)).to eq "1,00 kr"
345
355
  end
346
356
 
347
- specify "(:symbol => "", nil or false) returns the amount without a symbol" do
357
+ specify "(symbol: "", nil or false) returns the amount without a symbol" do
348
358
  money = Money.new(100, "GBP")
349
- expect(money.format(:symbol => "")).to eq "1.00"
350
- expect(money.format(:symbol => nil)).to eq "1.00"
351
- expect(money.format(:symbol => false)).to eq "1.00"
359
+ expect(money.format(symbol: "")).to eq "1.00"
360
+ expect(money.format(symbol: nil)).to eq "1.00"
361
+ expect(money.format(symbol: false)).to eq "1.00"
352
362
 
353
363
  money = Money.new(100, "JPY")
354
- expect(money.format(:symbol => false)).to eq "100"
364
+ expect(money.format(symbol: false)).to eq "100"
355
365
  end
356
366
 
357
367
  it "defaults :symbol to true" do
@@ -365,19 +375,19 @@ describe Money, "formatting" do
365
375
  expect(money.format).to eq "€1,00"
366
376
  end
367
377
 
368
- specify "(:symbol => false) returns a signed amount without a symbol" do
378
+ specify "(symbol: false) returns a signed amount without a symbol" do
369
379
  money = Money.new(-100, "EUR")
370
- expect(money.format(:symbol => false)).to eq "-1,00"
380
+ expect(money.format(symbol: false)).to eq "-1,00"
371
381
 
372
382
  money = Money.new(100, "EUR")
373
- expect(money.format(:symbol => false,
374
- :sign_positive => true)).to eq "+1,00"
383
+ expect(money.format(symbol: false,
384
+ sign_positive: true)).to eq "+1,00"
375
385
  end
376
386
  end
377
387
 
378
388
  describe ":decimal_mark option" do
379
- specify "(:decimal_mark => a decimal_mark string) works as documented" do
380
- expect(Money.us_dollar(100).format(:decimal_mark => ",")).to eq "$1,00"
389
+ specify "(decimal_mark: a decimal_mark string) works as documented" do
390
+ expect(Money.us_dollar(100).format(decimal_mark: ",")).to eq "$1,00"
381
391
  end
382
392
 
383
393
  it "defaults to '.' if currency isn't recognized" do
@@ -386,51 +396,51 @@ describe Money, "formatting" do
386
396
  end
387
397
 
388
398
  describe ":separator option" do
389
- specify "(:separator => a separator string) works as documented" do
390
- expect(Money.us_dollar(100).format(:separator => ",")).to eq "$1,00"
399
+ specify "(separator: a separator string) works as documented" do
400
+ expect(Money.us_dollar(100).format(separator: ",")).to eq "$1,00"
391
401
  end
392
402
  end
393
403
 
394
404
  describe ":south_asian_number_formatting delimiter" do
395
405
  before(:each) do
396
- Money::Currency.register(JSON.parse(INDIAN_BAR, :symbolize_names => true))
406
+ Money::Currency.register(JSON.parse(INDIAN_BAR, symbolize_names: true))
397
407
  end
398
408
 
399
409
  after(:each) do
400
- Money::Currency.unregister(JSON.parse(INDIAN_BAR, :symbolize_names => true))
410
+ Money::Currency.unregister(JSON.parse(INDIAN_BAR, symbolize_names: true))
401
411
  end
402
412
 
403
- specify "(:south_asian_number_formatting => true) works as documented" do
404
- expect(Money.new(10000000, 'INR').format(:south_asian_number_formatting => true, :symbol => false)).to eq "1,00,000.00"
405
- expect(Money.new(1000000000, 'INDIAN_BAR').format(:south_asian_number_formatting => true, :symbol => false)).to eq "1,00,000.0000"
406
- expect(Money.new(10000000).format(:south_asian_number_formatting => true)).to eq "$1,00,000.00"
413
+ specify "(south_asian_number_formatting: true) works as documented" do
414
+ expect(Money.new(10000000, 'INR').format(south_asian_number_formatting: true, symbol: false)).to eq "1,00,000.00"
415
+ expect(Money.new(1000000000, 'INDIAN_BAR').format(south_asian_number_formatting: true, symbol: false)).to eq "1,00,000.0000"
416
+ expect(Money.new(10000000).format(south_asian_number_formatting: true)).to eq "$1,00,000.00"
407
417
  end
408
418
 
409
- specify "(:south_asian_number_formatting => true and no_cents_if_whole => true) works as documented" do
410
- expect(Money.new(10000000, 'INR').format(:south_asian_number_formatting => true, :symbol => false, :no_cents_if_whole => true)).to eq "1,00,000"
411
- expect(Money.new(1000000000, 'INDIAN_BAR').format(:south_asian_number_formatting => true, :symbol => false, :no_cents_if_whole => true)).to eq "1,00,000"
419
+ specify "(south_asian_number_formatting: true and no_cents_if_whole => true) works as documented" do
420
+ expect(Money.new(10000000, 'INR').format(south_asian_number_formatting: true, symbol: false, no_cents_if_whole: true)).to eq "1,00,000"
421
+ expect(Money.new(1000000000, 'INDIAN_BAR').format(south_asian_number_formatting: true, symbol: false, no_cents_if_whole: true)).to eq "1,00,000"
412
422
  end
413
423
  end
414
424
 
415
425
  describe ":thousands_separator option" do
416
- specify "(:thousands_separator => a thousands_separator string) works as documented" do
417
- expect(Money.us_dollar(100000).format(:thousands_separator => ".")).to eq "$1.000.00"
418
- expect(Money.us_dollar(200000).format(:thousands_separator => "")).to eq "$2000.00"
426
+ specify "(thousands_separator: a thousands_separator string) works as documented" do
427
+ expect(Money.us_dollar(100000).format(thousands_separator: ".")).to eq "$1.000.00"
428
+ expect(Money.us_dollar(200000).format(thousands_separator: "")).to eq "$2000.00"
419
429
  end
420
430
 
421
- specify "(:thousands_separator => false or nil) works as documented" do
422
- expect(Money.us_dollar(100000).format(:thousands_separator => false)).to eq "$1000.00"
423
- expect(Money.us_dollar(200000).format(:thousands_separator => nil)).to eq "$2000.00"
431
+ specify "(thousands_separator: false or nil) works as documented" do
432
+ expect(Money.us_dollar(100000).format(thousands_separator: false)).to eq "$1000.00"
433
+ expect(Money.us_dollar(200000).format(thousands_separator: nil)).to eq "$2000.00"
424
434
  end
425
435
 
426
- specify "(:delimiter => a delimiter string) works as documented" do
427
- expect(Money.us_dollar(100000).format(:delimiter => ".")).to eq "$1.000.00"
428
- expect(Money.us_dollar(200000).format(:delimiter => "")).to eq "$2000.00"
436
+ specify "(delimiter: a delimiter string) works as documented" do
437
+ expect(Money.us_dollar(100000).format(delimiter: ".")).to eq "$1.000.00"
438
+ expect(Money.us_dollar(200000).format(delimiter: "")).to eq "$2000.00"
429
439
  end
430
440
 
431
- specify "(:delimiter => false or nil) works as documented" do
432
- expect(Money.us_dollar(100000).format(:delimiter => false)).to eq "$1000.00"
433
- expect(Money.us_dollar(200000).format(:delimiter => nil)).to eq "$2000.00"
441
+ specify "(delimiter: false or nil) works as documented" do
442
+ expect(Money.us_dollar(100000).format(delimiter: false)).to eq "$1000.00"
443
+ expect(Money.us_dollar(200000).format(delimiter: nil)).to eq "$2000.00"
434
444
  end
435
445
 
436
446
  it "defaults to ',' if currency isn't recognized" do
@@ -441,11 +451,11 @@ describe Money, "formatting" do
441
451
  before { Money.use_i18n = false }
442
452
 
443
453
  it "should respect explicit overriding of thousands_separator/delimiter when decimal_mark/separator collide and there’s no decimal component for currencies that have no subunit" do
444
- expect(Money.new(300_000, 'ISK').format(:thousands_separator => ",", decimal_mark: '.')).to eq "kr300,000"
454
+ expect(Money.new(300_000, 'ISK').format(thousands_separator: ",", decimal_mark: '.')).to eq "kr300,000"
445
455
  end
446
456
 
447
457
  it "should respect explicit overriding of thousands_separator/delimiter when decimal_mark/separator collide and there’s no decimal component for currencies with subunits that drop_trailing_zeros" do
448
- expect(Money.new(300_000, 'USD').format(:thousands_separator => ".", decimal_mark: ',', drop_trailing_zeros: true)).to eq "$3.000"
458
+ expect(Money.new(300_000, 'USD').format(thousands_separator: ".", decimal_mark: ',', drop_trailing_zeros: true)).to eq "$3.000"
449
459
  end
450
460
 
451
461
  after { Money.use_i18n = true}
@@ -453,131 +463,131 @@ describe Money, "formatting" do
453
463
  end
454
464
 
455
465
  describe ":thousands_separator and :decimal_mark option" do
456
- specify "(:thousands_separator => a thousands_separator string, :decimal_mark => a decimal_mark string) works as documented" do
466
+ specify "(thousands_separator: a thousands_separator string, decimal_mark: a decimal_mark string) works as documented" do
457
467
  expect(Money.new(123_456_789, "USD").format(thousands_separator: ".", decimal_mark: ",")).to eq("$1.234.567,89")
458
468
  expect(Money.new(987_654_321, "USD").format(thousands_separator: " ", decimal_mark: ".")).to eq("$9 876 543.21")
459
469
  end
460
470
  end
461
471
 
462
472
  describe ":html option" do
463
- specify "(:html => true) works as documented" do
464
- string = Money.ca_dollar(570).format(:html => true, :with_currency => true)
473
+ specify "(html: true) works as documented" do
474
+ string = Money.ca_dollar(570).format(html: true, with_currency: true)
465
475
  expect(string).to eq "$5.70 <span class=\"currency\">CAD</span>"
466
476
  end
467
477
 
468
478
  specify "should fallback to symbol if entity is not available" do
469
- string = Money.new(570, 'DKK').format(:html => true)
479
+ string = Money.new(570, 'DKK').format(html: true)
470
480
  expect(string).to eq "5,70 kr."
471
481
  end
472
482
  end
473
483
 
474
484
  describe ":html_wrap_symbol option" do
475
- specify "(:html_wrap_symbol => true) works as documented" do
476
- string = Money.ca_dollar(570).format(:html_wrap_symbol => true)
485
+ specify "(html_wrap_symbol: true) works as documented" do
486
+ string = Money.ca_dollar(570).format(html_wrap_symbol: true)
477
487
  expect(string).to eq "<span class=\"currency_symbol\">$</span>5.70"
478
488
  end
479
489
  end
480
490
 
481
491
  describe ":symbol_position option" do
482
492
  it "inserts currency symbol before the amount when set to :before" do
483
- expect(Money.euro(1_234_567_12).format(:symbol_position => :before)).to eq "€1.234.567,12"
493
+ expect(Money.euro(1_234_567_12).format(symbol_position: :before)).to eq "€1.234.567,12"
484
494
  end
485
495
 
486
496
  it "inserts currency symbol after the amount when set to :after" do
487
- expect(Money.us_dollar(1_000_000_000_12).format(:symbol_position => :after)).to eq "1,000,000,000.12 $"
497
+ expect(Money.us_dollar(1_000_000_000_12).format(symbol_position: :after)).to eq "1,000,000,000.12 $"
488
498
  end
489
499
 
490
500
  it "raises an ArgumentError when passed an invalid option" do
491
- expect{Money.euro(0).format(:symbol_position => :befor)}.to raise_error(ArgumentError)
501
+ expect{Money.euro(0).format(symbol_position: :befor)}.to raise_error(ArgumentError)
492
502
  end
493
503
  end
494
504
 
495
505
  describe ":sign_before_symbol option" do
496
- specify "(:sign_before_symbol => true) works as documented" do
497
- expect(Money.us_dollar(-100000).format(:sign_before_symbol => true)).to eq "-$1,000.00"
506
+ specify "(sign_before_symbol: true) works as documented" do
507
+ expect(Money.us_dollar(-100000).format(sign_before_symbol: true)).to eq "-$1,000.00"
498
508
  end
499
509
 
500
- specify "(:sign_before_symbol => false) works as documented" do
501
- expect(Money.us_dollar(-100000).format(:sign_before_symbol => false)).to eq "$-1,000.00"
502
- expect(Money.us_dollar(-100000).format(:sign_before_symbol => nil)).to eq "$-1,000.00"
510
+ specify "(sign_before_symbol: false) works as documented" do
511
+ expect(Money.us_dollar(-100000).format(sign_before_symbol: false)).to eq "$-1,000.00"
512
+ expect(Money.us_dollar(-100000).format(sign_before_symbol: nil)).to eq "$-1,000.00"
503
513
  end
504
514
  end
505
515
 
506
516
  describe ":symbol_before_without_space option" do
507
517
  it "does not insert space between currency symbol and amount when set to true" do
508
- expect(Money.euro(1_234_567_12).format(:symbol_position => :before, :symbol_before_without_space => true)).to eq "€1.234.567,12"
518
+ expect(Money.euro(1_234_567_12).format(symbol_position: :before, symbol_before_without_space: true)).to eq "€1.234.567,12"
509
519
  end
510
520
 
511
521
  it "inserts space between currency symbol and amount when set to false" do
512
- expect(Money.euro(1_234_567_12).format(:symbol_position => :before, :symbol_before_without_space => false)).to eq "€ 1.234.567,12"
522
+ expect(Money.euro(1_234_567_12).format(symbol_position: :before, symbol_before_without_space: false)).to eq "€ 1.234.567,12"
513
523
  end
514
524
 
515
525
  it "defaults to true" do
516
- expect(Money.euro(1_234_567_12).format(:symbol_position => :before)).to eq "€1.234.567,12"
526
+ expect(Money.euro(1_234_567_12).format(symbol_position: :before)).to eq "€1.234.567,12"
517
527
  end
518
528
  end
519
529
 
520
530
  describe ":symbol_after_without_space option" do
521
531
  it "does not insert space between amount and currency symbol when set to true" do
522
- expect(Money.euro(1_234_567_12).format(:symbol_position => :after, :symbol_after_without_space => true)).to eq "1.234.567,12€"
532
+ expect(Money.euro(1_234_567_12).format(symbol_position: :after, symbol_after_without_space: true)).to eq "1.234.567,12€"
523
533
  end
524
534
 
525
535
  it "inserts space between amount and currency symbol when set to false" do
526
- expect(Money.euro(1_234_567_12).format(:symbol_position => :after, :symbol_after_without_space => false)).to eq "1.234.567,12 €"
536
+ expect(Money.euro(1_234_567_12).format(symbol_position: :after, symbol_after_without_space: false)).to eq "1.234.567,12 €"
527
537
  end
528
538
 
529
539
  it "defaults to false" do
530
- expect(Money.euro(1_234_567_12).format(:symbol_position => :after)).to eq "1.234.567,12 €"
540
+ expect(Money.euro(1_234_567_12).format(symbol_position: :after)).to eq "1.234.567,12 €"
531
541
  end
532
542
  end
533
543
 
534
544
  describe ":sign_positive option" do
535
- specify "(:sign_positive => true, :sign_before_symbol => true) works as documented" do
536
- expect(Money.us_dollar( 0).format(:sign_positive => true, :sign_before_symbol => true)).to eq "$0.00"
537
- expect(Money.us_dollar( 100000).format(:sign_positive => true, :sign_before_symbol => true)).to eq "+$1,000.00"
538
- expect(Money.us_dollar(-100000).format(:sign_positive => true, :sign_before_symbol => true)).to eq "-$1,000.00"
545
+ specify "(sign_positive: true, sign_before_symbol: true) works as documented" do
546
+ expect(Money.us_dollar( 0).format(sign_positive: true, sign_before_symbol: true)).to eq "$0.00"
547
+ expect(Money.us_dollar( 100000).format(sign_positive: true, sign_before_symbol: true)).to eq "+$1,000.00"
548
+ expect(Money.us_dollar(-100000).format(sign_positive: true, sign_before_symbol: true)).to eq "-$1,000.00"
539
549
  end
540
550
 
541
- specify "(:sign_positive => true, :sign_before_symbol => false) works as documented" do
542
- expect(Money.us_dollar( 0).format(:sign_positive => true, :sign_before_symbol => false)).to eq "$0.00"
543
- expect(Money.us_dollar( 100000).format(:sign_positive => true, :sign_before_symbol => false)).to eq "$+1,000.00"
544
- expect(Money.us_dollar( 100000).format(:sign_positive => true, :sign_before_symbol => nil)).to eq "$+1,000.00"
545
- expect(Money.us_dollar(-100000).format(:sign_positive => true, :sign_before_symbol => false)).to eq "$-1,000.00"
546
- expect(Money.us_dollar(-100000).format(:sign_positive => true, :sign_before_symbol => nil)).to eq "$-1,000.00"
551
+ specify "(sign_positive: true, sign_before_symbol: false) works as documented" do
552
+ expect(Money.us_dollar( 0).format(sign_positive: true, sign_before_symbol: false)).to eq "$0.00"
553
+ expect(Money.us_dollar( 100000).format(sign_positive: true, sign_before_symbol: false)).to eq "$+1,000.00"
554
+ expect(Money.us_dollar( 100000).format(sign_positive: true, sign_before_symbol: nil)).to eq "$+1,000.00"
555
+ expect(Money.us_dollar(-100000).format(sign_positive: true, sign_before_symbol: false)).to eq "$-1,000.00"
556
+ expect(Money.us_dollar(-100000).format(sign_positive: true, sign_before_symbol: nil)).to eq "$-1,000.00"
547
557
  end
548
558
 
549
- specify "(:sign_positive => false, :sign_before_symbol => true) works as documented" do
550
- expect(Money.us_dollar( 100000).format(:sign_positive => false, :sign_before_symbol => true)).to eq "$1,000.00"
551
- expect(Money.us_dollar(-100000).format(:sign_positive => false, :sign_before_symbol => true)).to eq "-$1,000.00"
559
+ specify "(sign_positive: false, sign_before_symbol: true) works as documented" do
560
+ expect(Money.us_dollar( 100000).format(sign_positive: false, sign_before_symbol: true)).to eq "$1,000.00"
561
+ expect(Money.us_dollar(-100000).format(sign_positive: false, sign_before_symbol: true)).to eq "-$1,000.00"
552
562
  end
553
563
 
554
- specify "(:sign_positive => false, :sign_before_symbol => false) works as documented" do
555
- expect(Money.us_dollar( 100000).format(:sign_positive => false, :sign_before_symbol => false)).to eq "$1,000.00"
556
- expect(Money.us_dollar( 100000).format(:sign_positive => false, :sign_before_symbol => nil)).to eq "$1,000.00"
557
- expect(Money.us_dollar(-100000).format(:sign_positive => false, :sign_before_symbol => false)).to eq "$-1,000.00"
558
- expect(Money.us_dollar(-100000).format(:sign_positive => false, :sign_before_symbol => nil)).to eq "$-1,000.00"
564
+ specify "(sign_positive: false, sign_before_symbol: false) works as documented" do
565
+ expect(Money.us_dollar( 100000).format(sign_positive: false, sign_before_symbol: false)).to eq "$1,000.00"
566
+ expect(Money.us_dollar( 100000).format(sign_positive: false, sign_before_symbol: nil)).to eq "$1,000.00"
567
+ expect(Money.us_dollar(-100000).format(sign_positive: false, sign_before_symbol: false)).to eq "$-1,000.00"
568
+ expect(Money.us_dollar(-100000).format(sign_positive: false, sign_before_symbol: nil)).to eq "$-1,000.00"
559
569
  end
560
570
  end
561
571
 
562
572
  describe ":rounded_infinite_precision option", :infinite_precision do
563
573
  it "does round fractional when set to true" do
564
- expect(Money.new(BigDecimal('12.1'), "USD").format(:rounded_infinite_precision => true)).to eq "$0.12"
565
- expect(Money.new(BigDecimal('12.5'), "USD").format(:rounded_infinite_precision => true)).to eq "$0.13"
566
- expect(Money.new(BigDecimal('123.1'), "BHD").format(:rounded_infinite_precision => true)).to eq "ب.د0.123"
567
- expect(Money.new(BigDecimal('123.5'), "BHD").format(:rounded_infinite_precision => true)).to eq "ب.د0.124"
568
- expect(Money.new(BigDecimal('100.1'), "USD").format(:rounded_infinite_precision => true)).to eq "$1.00"
569
- expect(Money.new(BigDecimal('109.5'), "USD").format(:rounded_infinite_precision => true)).to eq "$1.10"
570
- expect(Money.new(BigDecimal('1.7'), "MGA").format(:rounded_infinite_precision => true)).to eq "Ar0.4"
574
+ expect(Money.new(BigDecimal('12.1'), "USD").format(rounded_infinite_precision: true)).to eq "$0.12"
575
+ expect(Money.new(BigDecimal('12.5'), "USD").format(rounded_infinite_precision: true)).to eq "$0.13"
576
+ expect(Money.new(BigDecimal('123.1'), "BHD").format(rounded_infinite_precision: true)).to eq "ب.د0.123"
577
+ expect(Money.new(BigDecimal('123.5'), "BHD").format(rounded_infinite_precision: true)).to eq "ب.د0.124"
578
+ expect(Money.new(BigDecimal('100.1'), "USD").format(rounded_infinite_precision: true)).to eq "$1.00"
579
+ expect(Money.new(BigDecimal('109.5'), "USD").format(rounded_infinite_precision: true)).to eq "$1.10"
580
+ expect(Money.new(BigDecimal('1.7'), "MGA").format(rounded_infinite_precision: true)).to eq "Ar0.4"
571
581
  end
572
582
 
573
583
  it "does not round fractional when set to false" do
574
- expect(Money.new(BigDecimal('12.1'), "USD").format(:rounded_infinite_precision => false)).to eq "$0.121"
575
- expect(Money.new(BigDecimal('12.5'), "USD").format(:rounded_infinite_precision => false)).to eq "$0.125"
576
- expect(Money.new(BigDecimal('123.1'), "BHD").format(:rounded_infinite_precision => false)).to eq "ب.د0.1231"
577
- expect(Money.new(BigDecimal('123.5'), "BHD").format(:rounded_infinite_precision => false)).to eq "ب.د0.1235"
578
- expect(Money.new(BigDecimal('100.1'), "USD").format(:rounded_infinite_precision => false)).to eq "$1.001"
579
- expect(Money.new(BigDecimal('109.5'), "USD").format(:rounded_infinite_precision => false)).to eq "$1.095"
580
- expect(Money.new(BigDecimal('1.7'), "MGA").format(:rounded_infinite_precision => false)).to eq "Ar0.34"
584
+ expect(Money.new(BigDecimal('12.1'), "USD").format(rounded_infinite_precision: false)).to eq "$0.121"
585
+ expect(Money.new(BigDecimal('12.5'), "USD").format(rounded_infinite_precision: false)).to eq "$0.125"
586
+ expect(Money.new(BigDecimal('123.1'), "BHD").format(rounded_infinite_precision: false)).to eq "ب.د0.1231"
587
+ expect(Money.new(BigDecimal('123.5'), "BHD").format(rounded_infinite_precision: false)).to eq "ب.د0.1235"
588
+ expect(Money.new(BigDecimal('100.1'), "USD").format(rounded_infinite_precision: false)).to eq "$1.001"
589
+ expect(Money.new(BigDecimal('109.5'), "USD").format(rounded_infinite_precision: false)).to eq "$1.095"
590
+ expect(Money.new(BigDecimal('1.7'), "MGA").format(rounded_infinite_precision: false)).to eq "Ar0.34"
581
591
  end
582
592
 
583
593
  describe "with i18n = false" do
@@ -590,13 +600,13 @@ describe Money, "formatting" do
590
600
  end
591
601
 
592
602
  it 'does round fractional when set to true' do
593
- expect(Money.new(BigDecimal('12.1'), "EUR").format(:rounded_infinite_precision => true)).to eq "€0,12"
594
- expect(Money.new(BigDecimal('12.5'), "EUR").format(:rounded_infinite_precision => true)).to eq "€0,13"
595
- expect(Money.new(BigDecimal('100.1'), "EUR").format(:rounded_infinite_precision => true)).to eq "€1,00"
596
- expect(Money.new(BigDecimal('109.5'), "EUR").format(:rounded_infinite_precision => true)).to eq "€1,10"
603
+ expect(Money.new(BigDecimal('12.1'), "EUR").format(rounded_infinite_precision: true)).to eq "€0,12"
604
+ expect(Money.new(BigDecimal('12.5'), "EUR").format(rounded_infinite_precision: true)).to eq "€0,13"
605
+ expect(Money.new(BigDecimal('100.1'), "EUR").format(rounded_infinite_precision: true)).to eq "€1,00"
606
+ expect(Money.new(BigDecimal('109.5'), "EUR").format(rounded_infinite_precision: true)).to eq "€1,10"
597
607
 
598
- expect(Money.new(BigDecimal('100012.1'), "EUR").format(:rounded_infinite_precision => true)).to eq "€1.000,12"
599
- expect(Money.new(BigDecimal('100012.5'), "EUR").format(:rounded_infinite_precision => true)).to eq "€1.000,13"
608
+ expect(Money.new(BigDecimal('100012.1'), "EUR").format(rounded_infinite_precision: true)).to eq "€1.000,12"
609
+ expect(Money.new(BigDecimal('100012.5'), "EUR").format(rounded_infinite_precision: true)).to eq "€1.000,13"
600
610
  end
601
611
  end
602
612
 
@@ -607,7 +617,7 @@ describe Money, "formatting" do
607
617
  I18n.locale = :de
608
618
  I18n.backend.store_translations(
609
619
  :de,
610
- :number => { :currency => { :format => { :delimiter => ".", :separator => "," } } }
620
+ number: { currency: { format: { delimiter: ".", separator: "," } } }
611
621
  )
612
622
  end
613
623
 
@@ -617,13 +627,13 @@ describe Money, "formatting" do
617
627
  end
618
628
 
619
629
  it 'does round fractional when set to true' do
620
- expect(Money.new(BigDecimal('12.1'), "USD").format(:rounded_infinite_precision => true)).to eq "$0,12"
621
- expect(Money.new(BigDecimal('12.5'), "USD").format(:rounded_infinite_precision => true)).to eq "$0,13"
622
- expect(Money.new(BigDecimal('123.1'), "BHD").format(:rounded_infinite_precision => true)).to eq "ب.د0,123"
623
- expect(Money.new(BigDecimal('123.5'), "BHD").format(:rounded_infinite_precision => true)).to eq "ب.د0,124"
624
- expect(Money.new(BigDecimal('100.1'), "USD").format(:rounded_infinite_precision => true)).to eq "$1,00"
625
- expect(Money.new(BigDecimal('109.5'), "USD").format(:rounded_infinite_precision => true)).to eq "$1,10"
626
- expect(Money.new(BigDecimal('1'), "MGA").format(:rounded_infinite_precision => true)).to eq "Ar0,2"
630
+ expect(Money.new(BigDecimal('12.1'), "USD").format(rounded_infinite_precision: true)).to eq "$0,12"
631
+ expect(Money.new(BigDecimal('12.5'), "USD").format(rounded_infinite_precision: true)).to eq "$0,13"
632
+ expect(Money.new(BigDecimal('123.1'), "BHD").format(rounded_infinite_precision: true)).to eq "ب.د0,123"
633
+ expect(Money.new(BigDecimal('123.5'), "BHD").format(rounded_infinite_precision: true)).to eq "ب.د0,124"
634
+ expect(Money.new(BigDecimal('100.1'), "USD").format(rounded_infinite_precision: true)).to eq "$1,00"
635
+ expect(Money.new(BigDecimal('109.5'), "USD").format(rounded_infinite_precision: true)).to eq "$1,10"
636
+ expect(Money.new(BigDecimal('1'), "MGA").format(rounded_infinite_precision: true)).to eq "Ar0,2"
627
637
  end
628
638
  end
629
639
  end
@@ -632,30 +642,30 @@ describe Money, "formatting" do
632
642
  let(:money) { Money.us_dollar(0) }
633
643
 
634
644
  it "returns 'free' when :display_free is true" do
635
- expect(money.format(:display_free => true)).to eq 'free'
645
+ expect(money.format(display_free: true)).to eq 'free'
636
646
  end
637
647
 
638
648
  it "returns '$0.00' when :display_free is false or not given" do
639
649
  expect(money.format).to eq '$0.00'
640
- expect(money.format(:display_free => false)).to eq '$0.00'
641
- expect(money.format(:display_free => nil)).to eq '$0.00'
650
+ expect(money.format(display_free: false)).to eq '$0.00'
651
+ expect(money.format(display_free: nil)).to eq '$0.00'
642
652
  end
643
653
 
644
654
  it "returns the value specified by :display_free if it's a string-like object" do
645
- expect(money.format(:display_free => 'gratis')).to eq 'gratis'
655
+ expect(money.format(display_free: 'gratis')).to eq 'gratis'
646
656
  end
647
657
  end
648
658
  end
649
659
 
650
660
  context "custom currencies with 4 decimal places" do
651
661
  before :each do
652
- Money::Currency.register(JSON.parse(BAR, :symbolize_names => true))
653
- Money::Currency.register(JSON.parse(EU4, :symbolize_names => true))
662
+ Money::Currency.register(JSON.parse(BAR, symbolize_names: true))
663
+ Money::Currency.register(JSON.parse(EU4, symbolize_names: true))
654
664
  end
655
665
 
656
666
  after :each do
657
- Money::Currency.unregister(JSON.parse(BAR, :symbolize_names => true))
658
- Money::Currency.unregister(JSON.parse(EU4, :symbolize_names => true))
667
+ Money::Currency.unregister(JSON.parse(BAR, symbolize_names: true))
668
+ Money::Currency.unregister(JSON.parse(EU4, symbolize_names: true))
659
669
  end
660
670
 
661
671
  it "respects custom subunit to unit, decimal and thousands separator" do
@@ -744,18 +754,18 @@ describe Money, "formatting" do
744
754
  end
745
755
 
746
756
  describe ":drop_trailing_zeros option" do
747
- specify "(:drop_trailing_zeros => true) works as documented" do
748
- expect(Money.new(89000, "BTC").format(:drop_trailing_zeros => true, :symbol => false)).to eq "0.00089"
749
- expect(Money.new(100089000, "BTC").format(:drop_trailing_zeros => true, :symbol => false)).to eq "1.00089"
750
- expect(Money.new(100000000, "BTC").format(:drop_trailing_zeros => true, :symbol => false)).to eq "1"
751
- expect(Money.new(110, "AUD").format(:drop_trailing_zeros => true, :symbol => false)).to eq "1.1"
752
- end
753
-
754
- specify "(:drop_trailing_zeros => false) works as documented" do
755
- expect(Money.new(89000, "BTC").format(:drop_trailing_zeros => false, :symbol => false)).to eq "0.00089000"
756
- expect(Money.new(100089000, "BTC").format(:drop_trailing_zeros => false, :symbol => false)).to eq "1.00089000"
757
- expect(Money.new(100000000, "BTC").format(:drop_trailing_zeros => false, :symbol => false)).to eq "1.00000000"
758
- expect(Money.new(110, "AUD").format(:drop_trailing_zeros => false, :symbol => false)).to eq "1.10"
757
+ specify "(drop_trailing_zeros: true) works as documented" do
758
+ expect(Money.new(89000, "BTC").format(drop_trailing_zeros: true, symbol: false)).to eq "0.00089"
759
+ expect(Money.new(100089000, "BTC").format(drop_trailing_zeros: true, symbol: false)).to eq "1.00089"
760
+ expect(Money.new(100000000, "BTC").format(drop_trailing_zeros: true, symbol: false)).to eq "1"
761
+ expect(Money.new(110, "AUD").format(drop_trailing_zeros: true, symbol: false)).to eq "1.1"
762
+ end
763
+
764
+ specify "(drop_trailing_zeros: false) works as documented" do
765
+ expect(Money.new(89000, "BTC").format(drop_trailing_zeros: false, symbol: false)).to eq "0.00089000"
766
+ expect(Money.new(100089000, "BTC").format(drop_trailing_zeros: false, symbol: false)).to eq "1.00089000"
767
+ expect(Money.new(100000000, "BTC").format(drop_trailing_zeros: false, symbol: false)).to eq "1.00000000"
768
+ expect(Money.new(110, "AUD").format(drop_trailing_zeros: false, symbol: false)).to eq "1.10"
759
769
  end
760
770
  end
761
771
  end