Sha256: 44f4bb2a1fe61244379109c3c7728fe5fb0c6247d0c2846c8383e92cf4fb21af

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true
RSpec.describe FinApps::REST::OrderStatuses do
  include SpecHelpers::Client

  describe '#show' do
    context 'when missing id' do
      subject { FinApps::REST::OrderStatuses.new(client).show(nil) }
      it { expect { subject }.to raise_error(FinAppsCore::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

4 entries across 4 versions & 1 rubygems

Version Path
finapps-2.2.4 spec/rest/order_statuses_spec.rb
finapps-2.2.3 spec/rest/order_statuses_spec.rb
finapps-2.2.2 spec/rest/order_statuses_spec.rb
finapps-2.2.1 spec/rest/order_statuses_spec.rb