mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-11-22 02:52:49 +01:00
Fix quoting amount to specific currency when base is Euro
This commit is contained in:
parent
5e1ccaa5ef
commit
fc98543702
@ -32,7 +32,7 @@ class Quotation
|
|||||||
|
|
||||||
return rates if @base == DEFAULT_BASE && @amount == 1.0
|
return rates if @base == DEFAULT_BASE && @amount == 1.0
|
||||||
|
|
||||||
if @symbols.nil? || @symbols.include?(DEFAULT_BASE)
|
if @symbols.nil? || @symbols.include?(DEFAULT_BASE) || @base == DEFAULT_BASE
|
||||||
rates.update(DEFAULT_BASE => 1.0)
|
rates.update(DEFAULT_BASE => 1.0)
|
||||||
end
|
end
|
||||||
divisor = rates.delete(@base)
|
divisor = rates.delete(@base)
|
||||||
|
@ -42,4 +42,12 @@ describe Quotation do
|
|||||||
rates['USD'].must_be :>, 10
|
rates['USD'].must_be :>, 10
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'when given an amount and symbols' do
|
||||||
|
it 'quotes for that amount' do
|
||||||
|
quotation = Quotation.new(amount: 100, symbols: ['USD'])
|
||||||
|
rates = quotation.quote[:rates]
|
||||||
|
rates['USD'].must_be :>, 10
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user