Sha256: c34569d67da3dd4dd9b3bbe1fffc97e49d5aec1371ca06fe95e3120d1f986715
Contents?: true
Size: 1007 Bytes
Versions: 3
Compression:
Stored size: 1007 Bytes
Contents
require 'spec_helper' module Danconia module Stores describe ActiveRecord, active_record: true do context 'save_rates' do it 'should create or update the rates' do ExchangeRate.create! pair: 'USDEUR', rate: 2 expect { subject.save_rates 'USDEUR' => 3, 'USDARS' => 4 }.to change { ExchangeRate.count }.by 1 expect(subject.rates).to eq('USDEUR' => 3, 'USDARS' => 4) end end context '#direct_rate' do it 'should find the rate for the pair' do ExchangeRate.create! pair: 'USDEUR', rate: 2 expect(subject.direct_rate('USD', 'EUR')).to eq 2 expect(subject.direct_rate('USD', 'ARS')).to eq nil end end before do ::ActiveRecord::Schema.define do create_table :exchange_rates do |t| t.string :pair, limit: 6 t.decimal :rate, precision: 12, scale: 6 t.index :pair, unique: true end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
danconia-0.2.8 | spec/danconia/stores/active_record_spec.rb |
danconia-0.2.7 | spec/danconia/stores/active_record_spec.rb |
danconia-0.2.6 | spec/danconia/stores/active_record_spec.rb |