Sha256: 80edda193239b165f47ff4f0a499162c6de77c14b1eed2f28c8087e7f41e652f

Contents?: true

Size: 1.33 KB

Versions: 51

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

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

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

  describe '#create_refund_reason' do
    context 'arguments' do

      it 'require `value`' do
        expect { client.create_refund_reason }
          .to raise_error(ArgumentError, /value/)
      end

      it 'require `description`' do
        expect { client.create_refund_reason }
          .to raise_error(ArgumentError, /description/)
      end

    end

    subject(:resource) do
      client.create_refund_reason(
        value: "Angry Donor",
        description: "Very Very not Happy",
        order: 500,
      )
    end

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

    it 'passes options' do
      expect(client).to receive(:post)
        .with(
          'DefinedValues',
          {
            'DefinedTypeId' => 37,
            'IsSystem' => false,
            'Order' => 500,
            'Description' => "Very Very not Happy",
            'Value' => "Angry Donor",
            'IsActive' => false
          }
        )
        .and_call_original
      resource
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
rock_rms-9.13.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-9.12.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-9.11.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-9.10.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-9.9.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-9.8.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-9.7.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-9.6.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-9.5.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-9.4.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-9.3.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-9.2.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-9.1.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-9.0.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-8.23.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-8.22.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-8.21.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-8.20.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-8.19.0 spec/rock_rms/resources/refund_reason_spec.rb
rock_rms-8.18.0 spec/rock_rms/resources/refund_reason_spec.rb