Browse Source

Do not error if owning_organisation is nil

pull/1280/head
Kat 3 years ago
parent
commit
b8154dcbb0
  1. 2
      app/services/exports/lettings_log_export_service.rb
  2. 2
      spec/services/exports/lettings_log_export_service_spec.rb

2
app/services/exports/lettings_log_export_service.rb

@ -266,7 +266,7 @@ module Exports
form << doc.create_element(key, value) form << doc.create_element(key, value)
end end
end end
form << doc.create_element("providertype", lettings_log.owning_organisation.read_attribute_before_type_cast(:provider_type)) form << doc.create_element("providertype", lettings_log.owning_organisation&.read_attribute_before_type_cast(:provider_type))
end end
xml_doc_to_temp_file(doc) xml_doc_to_temp_file(doc)

2
spec/services/exports/lettings_log_export_service_spec.rb

@ -128,7 +128,7 @@ RSpec.describe Exports::LettingsLogExportService do
context "and multiple lettings logs are available for export on same quarter" do context "and multiple lettings logs are available for export on same quarter" do
before do before do
FactoryBot.create(:lettings_log, startdate: Time.zone.local(2022, 2, 1), needstype: 2) FactoryBot.create(:lettings_log, startdate: Time.zone.local(2022, 2, 1), needstype: 2)
FactoryBot.create(:lettings_log, startdate: Time.zone.local(2022, 3, 20)) FactoryBot.create(:lettings_log, startdate: Time.zone.local(2022, 3, 20), owning_organisation: nil)
end end
it "generates an XML manifest file with the expected content within the ZIP file" do it "generates an XML manifest file with the expected content within the ZIP file" do

Loading…
Cancel
Save