Sha256: 9bcc0ccd4da8a2ae0896d48adda96fb28aad0c53fffb24f03a1a9c1cd86b5988

Contents?: true

Size: 1.27 KB

Versions: 34

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

require 'spec_helpers/client'

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

  describe '#create' do
    subject(:notifications) { described_class.new(client) }

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

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

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

      it { expect { create }.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('order id is invalid')
      end
    end

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

      it { expect { create }.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

34 entries across 34 versions & 1 rubygems

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