Sha256: 00840a89e7802190108b789f5e4c4c25e2ea07c7e358b890b0749aa3d513ef84

Contents?: true

Size: 1009 Bytes

Versions: 1

Compression:

Stored size: 1009 Bytes

Contents

require "spec_helper"

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

  describe "#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

  describe "#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

  describe "#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

1 entries across 1 versions & 1 rubygems

Version Path
nordea-2.0.2 spec/bank/bank_spec.rb