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
|
||||
|
||||
if @symbols.nil? || @symbols.include?(DEFAULT_BASE)
|
||||
if @symbols.nil? || @symbols.include?(DEFAULT_BASE) || @base == DEFAULT_BASE
|
||||
rates.update(DEFAULT_BASE => 1.0)
|
||||
end
|
||||
divisor = rates.delete(@base)
|
||||
|
@ -42,4 +42,12 @@ describe Quotation do
|
||||
rates['USD'].must_be :>, 10
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user