Sha256: 260cef3d5e39827cd993641e6bb533f94ef1ce36f89c6af4b937d2c7e95cd93f

Contents?: true

Size: 665 Bytes

Versions: 1

Compression:

Stored size: 665 Bytes

Contents

require 'spec_helper'

describe Hatsrank::Listing do
  let(:listing) { Hatsrank::Listing.new }
  let(:price) { 5000 }
  before do
    Money.default_bank.add_rate 'GBP', 'USD', 1.1

    listing.currency = currency
    listing.price = price
  end

  describe 'usd' do
    use_vcr_cassette
    subject { listing.usd }

    context 'currency does not exist' do
      let(:currency) { 9999 }

      it 'throws an exception' do
        expect { listing.usd }.to raise_error { Hatsrank::Listing::UnknownCurrencyException }
      end
    end

    context 'currency is GBP' do
      let(:currency) { 2002 }
      specify { subject.to_s.should == "55.00" }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hatsrank-0.0.1 spec/hatsrank/listing_spec.rb