diff --git a/lib/quotation.rb b/lib/quotation.rb index 1a36860..c0c050d 100644 --- a/lib/quotation.rb +++ b/lib/quotation.rb @@ -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) diff --git a/spec/quotation_spec.rb b/spec/quotation_spec.rb index 47c95a4..bfa4317 100644 --- a/spec/quotation_spec.rb +++ b/spec/quotation_spec.rb @@ -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