Sha256: 60a7d9956c5e8b624922ea4ee511f4fc558eff05671c63875317180af03f886f
Contents?: true
Size: 1.16 KB
Versions: 15
Compression:
Stored size: 1.16 KB
Contents
# frozen_string_literal: true describe CoinsPaid, '.currency' do let(:eth) { instance_double(CoinsPaid::API::Currency, currency: 'ETH') } subject(:currency) { described_class.currency(eth.currency) } context 'when CoinsPaid API responds correctly' do before do allow(CoinsPaid::API).to receive(:currencies_list) { currencies } end context 'and currency exists at CoinsPaid' do let(:currencies) do [eth, instance_double(CoinsPaid::API::Currency, currency: 'm' + eth.currency)] end it 'returns requested currency details' do expect(currency).to eq eth end end context 'and currency does not exist at CoinsPaid' do let(:currencies) do [instance_double(CoinsPaid::API::Currency, currency: 'm' + eth.currency)] end it 'errors' do expect { currency }.to raise_error(CoinsPaid::UnknownCurrency) end end end context 'when coins paid api errors' do before do allow(CoinsPaid::API).to receive(:currencies_list).and_raise(CoinsPaid::API::Error) end it 're-raises error' do expect { currency }.to raise_error(CoinsPaid::API::Error) end end end
Version data entries
15 entries across 15 versions & 1 rubygems