Sha256: 5874b9d5be62aab00474cfed0d6b9333d8243fe087f4dceaa5078b6794f1f58d

Contents?: true

Size: 1.21 KB

Versions: 32

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

require 'spec_helpers/client'

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

  describe '#update' do
    subject(:orders) { FinApps::REST::OrderNotifications.new(client) }

    context 'when missing id' do
      let(:update) { subject.update(nil) }
      it('returns missing argument error') { expect { update }.to raise_error(FinAppsCore::MissingArgumentsError) }
    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') { expect(error_messages.first.downcase).to eq('resource not found') }
    end

    context 'for 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

32 entries across 32 versions & 1 rubygems

Version Path
finapps-5.0.3 spec/rest/order_notifications_spec.rb
finapps-5.0.2 spec/rest/order_notifications_spec.rb
finapps-5.0.1 spec/rest/order_notifications_spec.rb
finapps-5.0.0 spec/rest/order_notifications_spec.rb
finapps-4.0.16 spec/rest/order_notifications_spec.rb
finapps-4.0.15 spec/rest/order_notifications_spec.rb
finapps-4.0.14 spec/rest/order_notifications_spec.rb
finapps-4.0.12 spec/rest/order_notifications_spec.rb
finapps-4.0.11 spec/rest/order_notifications_spec.rb
finapps-4.0.10 spec/rest/order_notifications_spec.rb
finapps-4.0.9 spec/rest/order_notifications_spec.rb
finapps-4.0.8 spec/rest/order_notifications_spec.rb
finapps-4.0.7 spec/rest/order_notifications_spec.rb
finapps-4.0.6 spec/rest/order_notifications_spec.rb
finapps-4.0.5 spec/rest/order_notifications_spec.rb
finapps-4.0.4 spec/rest/order_notifications_spec.rb
finapps-4.0.3 spec/rest/order_notifications_spec.rb
finapps-4.0.2 spec/rest/order_notifications_spec.rb
finapps-4.0.1 spec/rest/order_notifications_spec.rb
finapps-3.0.7 spec/rest/order_notifications_spec.rb