Sha256: 2184d2082249c7c56f775f2cc525a3213a9940578728503d171ca13fcc1fb7ee

Contents?: true

Size: 1.1 KB

Versions: 40

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

RSpec.describe FinApps::REST::OrderStatuses do
  include SpecHelpers::Client

  describe '#show' do
    context 'when missing id' do
      subject(:show) { described_class.new(client).show(nil) }

      it do
        expect { show }.to raise_error(FinAppsCore::MissingArgumentsError)
      end
    end

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

      it { expect { show }.not_to raise_error }

      it('performs a get and returns the response') do
        expect(show[RESULTS]).to have_key(:status)
      end

      it('returns no error messages') do
        expect(show[ERROR_MESSAGES]).to be_empty
      end
    end

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

      it { expect { show }.not_to raise_error }
      it('results is nil') { expect(show[RESULTS]).to be_nil }

      it('error messages array is populated') do
        expect(show[ERROR_MESSAGES].first.downcase).to eq(
          'resource not found'
        )
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
finapps-6.13.1 spec/rest/order_statuses_spec.rb
finapps-6.13.0 spec/rest/order_statuses_spec.rb
finapps-6.12.0 spec/rest/order_statuses_spec.rb
finapps-6.11.0 spec/rest/order_statuses_spec.rb
finapps-6.10.2 spec/rest/order_statuses_spec.rb
finapps-6.10.1 spec/rest/order_statuses_spec.rb
finapps-6.10.0 spec/rest/order_statuses_spec.rb
finapps-6.9.2 spec/rest/order_statuses_spec.rb
finapps-6.9.1 spec/rest/order_statuses_spec.rb
finapps-6.9.0 spec/rest/order_statuses_spec.rb
finapps-6.8.0 spec/rest/order_statuses_spec.rb
finapps-6.7.1 spec/rest/order_statuses_spec.rb
finapps-6.7.0 spec/rest/order_statuses_spec.rb
finapps-6.6.1 spec/rest/order_statuses_spec.rb
finapps-6.6.0 spec/rest/order_statuses_spec.rb
finapps-6.5.0 spec/rest/order_statuses_spec.rb
finapps-6.4.3 spec/rest/order_statuses_spec.rb
finapps-6.4.2 spec/rest/order_statuses_spec.rb
finapps-6.4.1 spec/rest/order_statuses_spec.rb
finapps-6.4.0 spec/rest/order_statuses_spec.rb