Sha256: 912170d3d7622da1d3d40a7cc51219afcde56de0b1f2015b8b1a7f47bfaf1fd2

Contents?: true

Size: 1.33 KB

Versions: 35

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

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

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

  describe '#create_payment_detail' do
    context 'arguments' do
      it 'require `payment_type`' do
        expect { client.create_payment_detail }
          .to raise_error(ArgumentError, /payment_type/)
      end
    end

    subject(:resource) do
      client.create_payment_detail(payment_type: 'card', card_type: 'amex')
    end

    it 'returns integer' do
      expect(resource).to be_a(Integer)
    end

    it 'passes options' do
      expect(client).to receive(:post)
        .with(
          'FinancialPaymentDetails',
          {
            'CurrencyTypeValueId' => 156,
            'CreditCardTypeValueId' => 159,
            'ForeignKey' => nil
          }
        )
        .and_call_original
      resource
    end
  end

  describe '#delete_payment_detail' do
    it 'returns nothing' do
      expect(client.delete_payment_detail(123)).to eq(nil)
    end

    it 'passes id' do
      expect(client).to receive(:delete).with('FinancialPaymentDetails/123')
      client.delete_payment_detail(123)
    end
  end

end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
rock_rms-8.21.0 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.20.0 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.19.0 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.18.0 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.17.0 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.16.0 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.15.2 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.15.1 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.15.0 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.14.0 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.13.0 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.12.0 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.11.0 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.10.0 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.9.0 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.8.0 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.7.0 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.6.0 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.5.0 spec/rock_rms/resources/payment_detail_spec.rb
rock_rms-8.4.0 spec/rock_rms/resources/payment_detail_spec.rb