Sha256: 19f5b09f8187278cc2a0f40aab1d64b8964be9add8c367ff6f1007bce1f54ea6

Contents?: true

Size: 1.23 KB

Versions: 40

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

require 'spec_helpers/client'

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

  describe '#update' do
    subject(:orders) { described_class.new(client) }

    context 'when missing id' do
      let(:update) { subject.update(nil) }

      it('returns missing argument error') do
        expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
      end
    end

    context 'when invalid id is provided' do
      let(:update) { subject.update(:invalid_id) }
      let(:results) { update[RESULTS] }
      let(:error_messages) { update[ERROR_MESSAGES] }

      it { expect { update }.not_to raise_error }
      it('results is nil') { expect(results).to be_nil }

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

    context 'with valid id' do
      let(:update) { subject.update(:valid_id) }
      let(:results) { update[RESULTS] }
      let(:error_messages) { update[ERROR_MESSAGES] }

      it { expect { update }.not_to raise_error }
      it('results is nil') { expect(results).to be_nil }
      it('error_messages array is empty') { expect(error_messages).to eq([]) }
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

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