Sha256: 98c0d12581b2b48c76e07c0a7a8d0df52907ab7cfbaae09701630b1b86a57c57

Contents?: true

Size: 1.43 KB

Versions: 64

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'

RSpec.describe RockRMS::Client::TransactionDetail, type: :model do
  include_context 'resource specs'

  describe '#list_transaction_details' do
    it 'returns a array' do
      resource = client.list_transaction_details
      expect(resource).to be_a(Array)
      expect(resource.first).to be_a(Hash)
    end
  end

  describe '#find_transaction_detail(id)' do
    it 'returns a hash' do
      expect(client.find_transaction_detail(123)).to be_a(Hash)
    end

    it 'queries ' do
      expect(client).to receive(:get).with('FinancialTransactionDetails/123')
        .and_call_original

      resource = client.find_transaction_detail(123)

      expect(resource[:id]).to eq(345)
    end

    it 'formats with TransactionDetail' do
      response = double
      expect(RockRMS::Response::TransactionDetail).to receive(:format).with(response)
      allow(client).to receive(:get).and_return(response)
      client.find_transaction_detail(123)
    end
  end

  describe '#update_transaction_detail' do
    subject(:resource) do
      client.update_transaction_detail(
        123,
        fund_id: 2,
      )
    end

    it 'returns nothing' do
      expect(client.update_transaction_detail(123, fund_id: 5)).to eq(nil)
    end

    it 'passes options' do
      expect(client).to receive(:patch)
        .with(
          'FinancialTransactionDetails/123',
          'AccountId' => 2
        ).and_call_original
      resource
    end
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
rock_rms-6.0.0 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.18.0 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.17.0 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.16.0 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.15.0 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.14.0 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.13.0 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.12.0 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.11.0 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.10.0 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.9.2 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.9.1 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.9.0 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.8.1 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.8.0 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.7.1 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.7.0 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.6.0 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.5.0 spec/rock_rms/resources/transaction_detail_spec.rb
rock_rms-5.4.0 spec/rock_rms/resources/transaction_detail_spec.rb