From b09deb86d35daeb038d3ee3eaea4a461c30b3c07 Mon Sep 17 00:00:00 2001 From: Kat Date: Wed, 10 Apr 2024 10:55:00 +0100 Subject: [PATCH] Update privacy notice BU validation --- app/services/bulk_upload/lettings/year2023/row_parser.rb | 2 +- .../bulk_upload/lettings/year2023/row_parser_spec.rb | 8 ++++++++ .../bulk_upload/lettings/year2024/row_parser_spec.rb | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/services/bulk_upload/lettings/year2023/row_parser.rb b/app/services/bulk_upload/lettings/year2023/row_parser.rb index 85d660bd5..7ce80b279 100644 --- a/app/services/bulk_upload/lettings/year2023/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2023/row_parser.rb @@ -517,7 +517,7 @@ private def validate_declaration_acceptance unless field_45 == 1 - errors.add(:field_45, I18n.t("validations.declaration.missing"), category: :setup) + errors.add(:field_45, I18n.t("validations.declaration.missing.pre_2024"), category: :setup) end end diff --git a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb index 6203b9c59..6b3652b6f 100644 --- a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb @@ -692,6 +692,14 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do expect(parser).not_to be_valid end end + + context "when the privacy notice is not accepted" do + let(:attributes) { valid_attributes.merge({ field_45: nil }) } + + it "cannot be nulled" do + expect(parser.errors[:field_45]).to eq(["You must show the DLUHC privacy notice to the tenant before you can submit this log."]) + end + end end describe "#validate_nulls" do diff --git a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb index d1c2fc761..7895b8eb5 100644 --- a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb @@ -787,6 +787,14 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do end end end + + context "when the privacy notice is not accepted" do + let(:attributes) { valid_attributes.merge({ field_15: nil }) } + + it "cannot be nulled" do + expect(parser.errors[:field_15]).to eq(["You must answer tenant has seen the privacy notice"]) + end + end end describe "#validate_nulls" do