Sha256: 5986a2e8a1c4e96638c261493aeb94ae4196dc51824e34db31fc2bcca92d8cf9
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe Arstotzka::Fetcher do describe 'yard' do describe '#fetch' do subject(:fetcher) { described_class.new(instance, **options) } let(:instance) { Account.new(hash) } let(:options) do { path: 'transactions', klass: Transaction, after: :filter_income } end let(:hash) do { transactions: [ { value: 1000.53, type: 'income' }, { value: 324.56, type: 'outcome' }, { value: 50.23, type: 'income' }, { value: 150.00, type: 'outcome' }, { value: 10.23, type: 'outcome' }, { value: 100.12, type: 'outcome' }, { value: 101.00, type: 'outcome' } ] } end describe 'incoming transactions' do it 'returns only the income payments' do expect(fetcher.fetch.count).to eq(2) end it 'returns Transactions' do expect(fetcher.fetch.map(&:class).uniq).to eq([Transaction]) end it 'returns results wrapped in Transactions' do expected = [ Transaction.new(value: 1000.53, type: 'income'), Transaction.new(value: 50.23, type: 'income') ] expect(fetcher.fetch).to eq(expected) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
arstotzka-1.2.0 | spec/integration/yard/arstotzka/fetcher_spec.rb |