Browse Source

Add test for missing organisation during import

pull/604/head
Stéphane Meny 3 years ago
parent
commit
0aed5b2afb
No known key found for this signature in database
GPG Key ID: 9D0AFEA988527923
  1. 13
      spec/services/imports/case_logs_import_service_spec.rb

13
spec/services/imports/case_logs_import_service_spec.rb

@ -88,5 +88,18 @@ RSpec.describe Imports::CaseLogsImportService do
expect(case_log.voiddate).to be_nil expect(case_log.voiddate).to be_nil
end end
end end
context "and the organisation legacy ID does not exist" do
let(:case_log_xml) do
xml_doc = Nokogiri::XML(case_log_file)
xml_doc.at_xpath("//xmlns:OWNINGORGID").content = 99999
xml_doc
end
it "raises an exception" do
expect { case_log_service.send(:create_log, case_log_xml) }
.to raise_error(RuntimeError, "Organisation not found with legacy ID 99999")
end
end
end end
end end

Loading…
Cancel
Save