diff --git a/lib/sequencer/unit/import/freshdesk/contact/mapping.rb b/lib/sequencer/unit/import/freshdesk/contact/mapping.rb index 58f25625b..4fdd2eeb0 100644 --- a/lib/sequencer/unit/import/freshdesk/contact/mapping.rb +++ b/lib/sequencer/unit/import/freshdesk/contact/mapping.rb @@ -29,7 +29,7 @@ class Sequencer private def organization_id - id_map['Organization'][resource['company_id']] + id_map.dig('Organization', resource['company_id']) end end end diff --git a/spec/lib/sequencer/sequence/import/freshdesk/contact_spec.rb b/spec/lib/sequencer/sequence/import/freshdesk/contact_spec.rb index fb5c6abcb..984758428 100644 --- a/spec/lib/sequencer/sequence/import/freshdesk/contact_spec.rb +++ b/spec/lib/sequencer/sequence/import/freshdesk/contact_spec.rb @@ -104,5 +104,15 @@ RSpec.describe ::Sequencer::Sequence::Import::Freshdesk::Contact, sequencer: :se expect(User.last).to have_attributes(imported_user) end end + + context 'without organizations' do + let(:id_map) do + {} + end + + it 'imports customer correctly (increased user count)' do + expect { process(process_payload) }.to change(User, :count).by(1) + end + end end end