Browse Source

Do not error if owning_organisation is nil (#1280)

pull/1284/head v0.2.38
kosiakkatrina 2 years ago committed by GitHub
parent
commit
2bff6e8092
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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