Skip to content

Commit 4a2bc2c

Browse files
committed
fixes after bumping money to 7.0.0
1 parent 58d261d commit 4a2bc2c

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

spec/core_extensions_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
'-1,000' => Money.new(-1_000_00),
6868
'1,000.5' => Money.new(1_000_50),
6969
'1,000.51' => Money.new(1_000_51),
70-
'1,000.505' => Money.new(1_000_50), # ROUND_HALF_EVEN default bankers rounding
71-
'1,000.515' => Money.new(1_000_52), # ROUND_HALF_EVEN default bankers rounding
70+
'1,000.505' => Money.new(1_000_51), # ROUND_HALF_UP default rounding
71+
'1,000.515' => Money.new(1_000_52), # ROUND_HALF_UP default rounding
7272
'1,000.504' => Money.new(1_000_50),
7373
'1,000.0000' => Money.new(1_000_00),
7474
'1,000.5000' => Money.new(1_000_50),
@@ -151,16 +151,16 @@
151151
expect('1.5'.to_money('KWD').cents).to eq 1_500
152152
end
153153

154-
it 'respects Money.rounding_mode' do
154+
it 'respects Money.with_rounding_mode' do
155155
expect('1.009'.to_money).to eq(Money.new(1_01))
156156

157-
Money.rounding_mode(BigDecimal::ROUND_DOWN) do
157+
Money.with_rounding_mode(BigDecimal::ROUND_DOWN) do
158158
expect('1.009'.to_money).to eq(Money.new(1_00))
159159
end
160160

161161
expect('1.001'.to_money).to eq(Money.new(1_00))
162162

163-
Money.rounding_mode(BigDecimal::ROUND_UP) do
163+
Money.with_rounding_mode(BigDecimal::ROUND_UP) do
164164
expect('1.001'.to_money).to eq(Money.new(1_01))
165165
end
166166
end
@@ -230,7 +230,7 @@
230230
expect(hash.to_money).to eq(Money.new(100, 'USD'))
231231
end
232232
end
233-
233+
234234
context 'when Money to_hash is used' do
235235
subject(:hash) { { cents: 100, currency_iso: 'SGD' } }
236236

spec/monetize_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,13 +545,13 @@
545545
expect(m.currency).to eq Money::Currency.wrap('EUR')
546546
end
547547

548-
context 'infinite_precision = true' do
548+
context 'default_infinite_precision = true' do
549549
before do
550-
Money.infinite_precision = true
550+
Money.default_infinite_precision = true
551551
end
552552

553553
after do
554-
Money.infinite_precision = false
554+
Money.default_infinite_precision = false
555555
end
556556

557557
it 'keeps precision' do

spec/spec_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
require 'money'
44

5+
Money.default_currency = 'USD'
6+
57
RSpec.configure do |config|
68
config.order = 'random'
79
end

0 commit comments

Comments
 (0)