Sha256: 764e0281c9e1ec14130ba450c700b05aafb815c637d4c6867c629c2b41b19930

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true
RSpec.describe FinApps::REST::OrderStatuses do
  let(:client) { FinApps::REST::Client.new(:company_identifier, :company_token) }
  describe '#show' do
    context 'when missing id' do
      subject { FinApps::REST::OrderStatuses.new(client).show(nil) }
      it { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
    end

    context 'when valid id is provided' do
      subject { FinApps::REST::OrderStatuses.new(client).show(:valid_id) }

      it { expect { subject }.not_to raise_error }
      it('performs a get and returns the response') { expect(subject[0]).to respond_to(:status) }
      it('returns no error messages') { expect(subject[1]).to be_empty }
    end

    context 'when invalid id is provided' do
      subject { FinApps::REST::OrderStatuses.new(client).show(:invalid_id) }

      it { expect { subject }.not_to raise_error }
      it('results is nil') { expect(subject[0]).to be_nil }
      it('error messages array is populated') { expect(subject[1].first.downcase).to eq('resource not found') }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
finapps-2.1.4 spec/rest/order_statuses_spec.rb
finapps-2.1.3 spec/rest/order_statuses_spec.rb
finapps-2.1.2 spec/rest/order_statuses_spec.rb
finapps-2.1.1 spec/rest/order_statuses_spec.rb
finapps-2.0.30 spec/rest/order_statuses_spec.rb