Sha256: c331383647bbeea60558a5dc4fa9eea0e56667fcae5e6d605880617ca191218f

Contents?: true

Size: 836 Bytes

Versions: 1

Compression:

Stored size: 836 Bytes

Contents

require 'spec_helper'

describe CurrencyConverter::Google do
  let(:currency_converter) { described_class.new }

  context '#exchange' do
    it 'returns the correct rate' do
      expect(currency_converter.exchange('USD', 'USD', 1)).to eq 1
    end
  end

  context '#validate_currency' do
    context 'CurrencyConverter::UnknownCurrency' do
      it 'raise an error on an unsupported currency code' do
        expect { currency_converter.exchange('EUR', 'UNKNOWN', 100) }.to raise_error(CurrencyConverter::UnknownCurrency)
        expect { currency_converter.exchange('UNKNOWN', 'EUR', 100) }.to raise_error(CurrencyConverter::UnknownCurrency)
      end

      it 'doesn\'t raise an error for supported currency codes' do
        expect { currency_converter.exchange('EUR', 'USD', 100) }.to_not raise_error
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
currency_converter-1.1.2 spec/currency_converter/google_spec.rb