diff --git a/lib/import/otrs/user_factory.rb b/lib/import/otrs/user_factory.rb index ea49ccc77..ce3430876 100644 --- a/lib/import/otrs/user_factory.rb +++ b/lib/import/otrs/user_factory.rb @@ -2,6 +2,14 @@ module Import module OTRS module UserFactory extend Import::Factory + + # rubocop:disable Style/ModuleFunction + extend self + + # skip root@localhost since we have our own \o/ + def skip?(record, *_args) + record['UserID'].to_i == 1 + end end end end diff --git a/spec/import/otrs/user_factory_spec.rb b/spec/import/otrs/user_factory_spec.rb index b88035417..4f38bf84a 100644 --- a/spec/import/otrs/user_factory_spec.rb +++ b/spec/import/otrs/user_factory_spec.rb @@ -3,4 +3,12 @@ require 'import/factory_examples' RSpec.describe Import::OTRS::UserFactory do it_behaves_like 'Import::Factory' + + it 'skips root@localhost' do + + root_data = json_fixture('import/otrs/user/default') + expect(Import::OTRS::User).to_not receive(:new) + + described_class.import([root_data]) + end end