Sha256: 9a185a235f585c88d7abd36d4344cc448143fe20055071500fb28f0e769cb911

Contents?: true

Size: 633 Bytes

Versions: 3

Compression:

Stored size: 633 Bytes

Contents

require 'spec_helper'
require 'date'
require './lib/fx_lib.rb'

#test for generating a fx table
describe 'Generating a fx table' do
  #url = "http://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml"
  url = './spec/internal/eurofx90d.xml'

  it 'should fetch all data given correct url' do
    FxLib::ExchangeRate.fetch_data(url)
    expect(FxRate.where(currency: 'USD', rate: '1.3727')).not_to be_empty
  end

  it 'should fetch data for a given date' do
    date = DateTime.new(2013,12,13)
    FxLib::ExchangeRate.fetch_data_on(url, date)
    expect(FxRate.where(currency: 'USD', rate: '1.3727')).not_to be_empty
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fx_lib-0.1.5 spec/acceptance/fx_table_spec.rb
fx_lib-0.1.4 spec/acceptance/fx_table_spec.rb
fx_lib-0.1.3 spec/acceptance/fx_table_spec.rb