Sha256: 75211516bf8facc2f2d905fbc6fdb18546b5a9254d3215dbcf86ab38d8bfe311
Contents?: true
Size: 1.17 KB
Versions: 37
Compression:
Stored size: 1.17 KB
Contents
require 'spec_helper' RSpec.describe RockRMS::Response::Transaction, type: :model do let(:parsed) { JSON.parse(FixturesHelper.read('transactions.json')) } describe '.format' do subject(:result) { described_class.format(parsed) } context 'when response is array' do it 'returns an array' do expect(described_class.format([])).to be_a(Array) end end it 'translates keys' do result.take(1).zip(parsed) do |r, p| expect(r[:id]).to eq(p['Id']) expect(r[:date]).to eq(p['TransactionDateTime']) expect(r[:batch_id]).to eq(p['BatchId']) expect(r[:recurring_donation_id]).to eq(p['ScheduledTransactionId']) expect(r[:summary]).to eq(p['Summary']) expect(r[:transaction_code]).to eq(p['TransactionCode']) expect(r[:payment_detail_id]).to eq(p['FinancialPaymentDetailId']) expect(r[:transaction_type_id]).to eq(p['TransactionTypeValueId']) expect(r[:source_type_id]).to eq(p['SourceTypeValueId']) expect(r[:details]).to eq( RockRMS::Response::TransactionDetail.format(p['TransactionDetails']) ) expect(r[:amount]).to eq(100.00) end end end end
Version data entries
37 entries across 37 versions & 1 rubygems