Sha256: f4ecdf3f93b440e1f4fc9f016d686629cedb1375ddf6b1ef0db08ad944f287ec

Contents?: true

Size: 1.07 KB

Versions: 13

Compression:

Stored size: 1.07 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[RESULTS]).to respond_to(:status) }
      it('returns no error messages') { expect(subject[ERROR_MESSAGES]).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[RESULTS]).to be_nil }
      it('error messages array is populated') do
        expect(subject[ERROR_MESSAGES].first.downcase).to eq('resource not found')
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
finapps-2.2.22 spec/rest/order_statuses_spec.rb
finapps-2.2.21 spec/rest/order_statuses_spec.rb
finapps-2.2.20 spec/rest/order_statuses_spec.rb
finapps-2.2.19 spec/rest/order_statuses_spec.rb
finapps-2.2.18 spec/rest/order_statuses_spec.rb
finapps-2.2.17 spec/rest/order_statuses_spec.rb
finapps-2.2.16 spec/rest/order_statuses_spec.rb
finapps-2.2.15 spec/rest/order_statuses_spec.rb
finapps-2.2.14 spec/rest/order_statuses_spec.rb
finapps-2.2.13 spec/rest/order_statuses_spec.rb
finapps-2.2.12 spec/rest/order_statuses_spec.rb
finapps-2.2.11 spec/rest/order_statuses_spec.rb
finapps-2.2.10 spec/rest/order_statuses_spec.rb