Sha256: e7177dfabb0a077563b862adb22eb2e04d70e413bde4d29bea944c4c3d035d76

Contents?: true

Size: 1010 Bytes

Versions: 2

Compression:

Stored size: 1010 Bytes

Contents

require "spec_helper"

describe "Nordea::Bank" do
  before(:each) do
    stub_request(:get, "http://service.nordea.com/nordea-openpages/fi/lists/currency/elelctronicExchangeFI.dat").
             to_return(:status => 200, :body => SampleData.raw)
    @bank = Nordea::Bank.new
    Money.default_bank = @bank
  end

  context "#exchange" do
    it "returns the correct exchange rates" do
      @bank.known_currencies.each do |currency|
        @bank.exchange(100, "EUR", currency).cents.should == (SampleData.get_rate(currency) * 100).round
      end
    end
  end

  context "#exchange_with" do
    it "returns the correct exchange rates" do
      @bank.known_currencies.each do |currency|
        @bank.exchange_with(Money.new(100, "EUR"), currency).cents.should == (SampleData.get_rate(currency) * 100).round
      end
    end
  end

  context "#exchange_rates" do
    it "is an instance of Nordea::ExchangeRates" do
      @bank.exchange_rates.should be_an_instance_of(Nordea::ExchangeRates)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nordea-1.1.0 spec/bank/bank_spec.rb
nordea-1.0.0 spec/bank/bank_spec.rb