Browse Source

Remove uprn validation for supported housing logs (#1992)

pull/1988/head
kosiakkatrina 1 year ago committed by GitHub
parent
commit
2c24f2bcab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/services/bulk_upload/lettings/year2023/row_parser.rb
  2. 18
      spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb

2
app/services/bulk_upload/lettings/year2023/row_parser.rb

@ -402,7 +402,7 @@ class BulkUpload::Lettings::Year2023::RowParser
validate :validate_nulls, on: :after_log
validate :validate_uprn_exists_if_any_key_address_fields_are_blank, on: :after_log
validate :validate_uprn_exists_if_any_key_address_fields_are_blank, on: :after_log, unless: -> { supported_housing? }
validate :validate_incomplete_soft_validations, on: :after_log

18
spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb

@ -1455,6 +1455,24 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
end
end
context "when neither UPRN nor address fields are given for a supported housing record" do
let(:bulk_upload) { create(:bulk_upload, :lettings, user:, needstype: 2) }
let(:attributes) do
{ bulk_upload:,
field_15: scheme.old_visible_id,
field_4: "2",
field_5: "2",
field_16: location.old_visible_id,
field_1: "1" }
end
it "does not add UPRN errors" do
expect(parser.errors[:field_18]).to be_empty
expect(parser.errors[:field_19]).to be_empty
expect(parser.errors[:field_21]).to be_empty
end
end
context "when UPRN is given but address fields are not" do
let(:attributes) do
{

Loading…
Cancel
Save