Sha256: d0f986faeaea21699f511626e6c0d69f308aed73a4f776c8438eac20e8e8fbe2

Contents?: true

Size: 1.23 KB

Versions: 20

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

RSpec.describe RDStation::ErrorHandler::ConflictingField do
  describe '#raise_error' do
    subject(:conflicting_field_errors) { described_class.new(errors) }

    context 'when none of the errors are conflicting field errors' do
      let(:errors) do
        [
          {
            'error_type' => 'RANDOM_ERROR_TYPE',
            'error_message' => 'Random error message'
          }
        ]
      end

      it 'does not raise the error' do
        result = conflicting_field_errors.raise_error
        expect(result).to be_nil
      end
    end

    context 'when there is a conflict field errors' do
      let(:errors) do
        [
          {
            'error_type' => 'CONFLICTING_FIELD',
            'error_message' => 'The payload contains an attribute that was used to identify the lead'
          }
        ]
      end

      it 'raises the error' do
        expect do
          conflicting_field_errors.raise_error
        end.to raise_error(RDStation::Error::ConflictingField)
      end
    end

    context 'when there are no errors' do
      let(:errors) { [] }

      it 'does not raise the error' do
        result = conflicting_field_errors.raise_error
        expect(result).to be_nil
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rdstation-ruby-client-2.9.0 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-2.8.2 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-2.8.1 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-2.8.0 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-2.7.0 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-2.6.0 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-2.5.3 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-2.5.2 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-2.5.1 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-2.5.0 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-2.4.0 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-2.3.1 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-2.3.0 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-2.2.0 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-2.1.0 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-2.0.0 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-1.2.1 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-1.2.0 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-1.1.0 spec/lib/rdstation/error_handler/conflicting_field_spec.rb
rdstation-ruby-client-1.0.1 spec/lib/rdstation/error_handler/conflicting_field_spec.rb