Sha256: 7770d344eee4cce96eab1f20c084e192dbec602a5e42c9d449942710ca15a9c0
Contents?: true
Size: 1.36 KB
Versions: 2
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 { described_class.new(hash, instance, path: path, **options) } let(:instance) { Account.new } let(:path) { 'transactions' } let(:options) do { clazz: 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(subject.fetch.count).to eq(2) end it 'returns Transactions' do expect(subject.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(subject.fetch).to eq(expected) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
arstotzka-1.0.3 | spec/integration/yard/arstotzka/fetcher_spec.rb |
arstotzka-1.0.2 | spec/integration/yard/arstotzka/fetcher_spec.rb |