From 63bf6a3d4d475d410d2f05566ea33cae14d11a51 Mon Sep 17 00:00:00 2001 From: oscar-richardson-softwire Date: Wed, 28 Jan 2026 08:27:01 +0000 Subject: [PATCH] Add tests for error on location field --- .../bulk_upload/lettings/year2026/row_parser_spec.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/spec/services/bulk_upload/lettings/year2026/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2026/row_parser_spec.rb index 8187b0a09..958c44a04 100644 --- a/spec/services/bulk_upload/lettings/year2026/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2026/row_parser_spec.rb @@ -1529,9 +1529,10 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do }}]}', headers: {}) end - it "adds an appropriate error to the UPRN field" do + it "adds an appropriate error to the UPRN and location fields" do parser.valid? expect(parser.errors[:field_18]).to eql([I18n.t("validations.lettings.property.uprn.postcode_does_not_match_scheme_location_postcode")]) + expect(parser.errors[:field_6]).to eql([I18n.t("validations.lettings.property.location_id.postcode_does_not_match_scheme_location_postcode")]) end end end @@ -1648,11 +1649,12 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do context "and the postcode entered manually does not match the postcode associated with the location" do let(:attributes) { base_attributes.merge({ field_18: nil, field_19: "address line 1", field_21: "town or city", field_23: "BB2", field_24: "2BB" }) } - it "adds appropriate errors to postcode and LA fields" do + it "adds appropriate errors to the postcode, LA and location fields" do parser.valid? expect(parser.errors[:field_23]).to eql([I18n.t("validations.lettings.property.postcode_full.does_not_match_scheme_location_postcode")]) expect(parser.errors[:field_24]).to eql([I18n.t("validations.lettings.property.postcode_full.does_not_match_scheme_location_postcode")]) expect(parser.errors[:field_25]).to eql([I18n.t("validations.lettings.property.postcode_full.does_not_match_scheme_location_postcode")]) + expect(parser.errors[:field_6]).to eql([I18n.t("validations.lettings.property.location_id.postcode_does_not_match_scheme_location_postcode")]) end end end @@ -1683,11 +1685,12 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do context "and the postcode entered manually does not match the postcode associated with the location" do let(:attributes) { base_attributes.merge({ field_18: nil, field_19: "address line 1", field_21: "town or city", field_23: "BB2", field_24: "2BB" }) } - it "adds appropriate errors to postcode and LA fields" do + it "adds appropriate errors to the postcode, LA and location fields" do parser.valid? expect(parser.errors[:field_23]).to eql([I18n.t("validations.lettings.property.postcode_full.does_not_match_scheme_location_postcode")]) expect(parser.errors[:field_24]).to eql([I18n.t("validations.lettings.property.postcode_full.does_not_match_scheme_location_postcode")]) expect(parser.errors[:field_25]).to eql([I18n.t("validations.lettings.property.postcode_full.does_not_match_scheme_location_postcode")]) + expect(parser.errors[:field_6]).to eql([I18n.t("validations.lettings.property.location_id.postcode_does_not_match_scheme_location_postcode")]) end end end @@ -1719,11 +1722,12 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do context "and the postcode entered manually does not match the postcode associated with the location" do let(:attributes) { base_attributes.merge({ field_18: nil, field_19: "address line 1", field_21: "town or city", field_23: "BB2", field_24: "2BB" }) } - it "adds appropriate errors to postcode and LA fields" do + it "adds appropriate errors to the postcode, LA and location fields" do parser.valid? expect(parser.errors[:field_23]).to eql([I18n.t("validations.lettings.property.postcode_full.does_not_match_scheme_location_postcode")]) expect(parser.errors[:field_24]).to eql([I18n.t("validations.lettings.property.postcode_full.does_not_match_scheme_location_postcode")]) expect(parser.errors[:field_25]).to eql([I18n.t("validations.lettings.property.postcode_full.does_not_match_scheme_location_postcode")]) + expect(parser.errors[:field_6]).to eql([I18n.t("validations.lettings.property.location_id.postcode_does_not_match_scheme_location_postcode")]) end end end