diff --git a/app/services/bulk_upload/sales/year2024/row_parser.rb b/app/services/bulk_upload/sales/year2024/row_parser.rb index 68f638e17..d39715f30 100644 --- a/app/services/bulk_upload/sales/year2024/row_parser.rb +++ b/app/services/bulk_upload/sales/year2024/row_parser.rb @@ -1364,13 +1364,13 @@ private if setup_question?(question) fields.each do |field| unless errors.any? { |e| fields.include?(e.attribute) } - errors.add(field, I18n.t("validations.not_answered", question: question.error_display_label&.downcase), category: :setup) + errors.add(field, question.unanswered_error_message, category: :setup) end end else fields.each do |field| unless errors.any? { |e| fields.include?(e.attribute) } - errors.add(field, I18n.t("validations.not_answered", question: question.error_display_label&.downcase)) + errors.add(field, question.unanswered_error_message) end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 4dfe72872..a53b375fe 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -590,12 +590,12 @@ en: declaration: missing: pre_2024: "You must show the MHCLG privacy notice to the tenant before you can submit this log" - post_2024: "You must show or give access to the MHCLG privacy notice to the tenant before you can submit this log" + post_2024: "You must show or give the tenant access to the MHCLG privacy notice before you can submit this log" privacynotice: missing: pre_2024: "You must show the MHCLG privacy notice to the %{buyer_or_buyers} before you can submit this log" - post_2024: "You must show or give access to the MHCLG privacy notice to the %{buyer_or_buyers} before you can submit this log" + post_2024: "You must show or give the %{buyer_or_buyers} access to the MHCLG privacy notice before you can submit this log" scheme: toggle_date: diff --git a/spec/models/form/lettings/questions/declaration_spec.rb b/spec/models/form/lettings/questions/declaration_spec.rb index 7e4d47249..c64e7f3c8 100644 --- a/spec/models/form/lettings/questions/declaration_spec.rb +++ b/spec/models/form/lettings/questions/declaration_spec.rb @@ -87,7 +87,7 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the tenant before you can submit this log") + expect(question.unanswered_error_message).to eq("You must show or give the tenant access to the MHCLG privacy notice before you can submit this log") end end end diff --git a/spec/models/form/sales/questions/privacy_notice_spec.rb b/spec/models/form/sales/questions/privacy_notice_spec.rb index bbaabb6a5..9fb81057a 100644 --- a/spec/models/form/sales/questions/privacy_notice_spec.rb +++ b/spec/models/form/sales/questions/privacy_notice_spec.rb @@ -100,7 +100,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the buyer before you can submit this log") + expect(question.unanswered_error_message).to eq("You must show or give the buyer access to the MHCLG privacy notice before you can submit this log") end end @@ -118,7 +118,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the buyers before you can submit this log") + expect(question.unanswered_error_message).to eq("You must show or give the buyers access to the MHCLG privacy notice before you can submit this log") end end end 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 405bb292d..25529cc19 100644 --- a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb @@ -747,7 +747,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "cannot be nulled" do parser.valid? - expect(parser.errors[:field_15]).to eq(["You must show or give access to the MHCLG privacy notice to the tenant before you can submit this log"]) + expect(parser.errors[:field_15]).to eq(["You must show or give the tenant access to the MHCLG privacy notice before you can submit this log"]) end end diff --git a/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb b/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb index 115995f3e..656ff7a2f 100644 --- a/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb @@ -1042,12 +1042,21 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do describe "#field_18" do # data protection let(:attributes) { setup_section_params.merge({ field_18: nil }) } + before do + parser.valid? + end + context "when not answered" do it "returns a setup error" do - parser.valid? expect(parser.errors.where(:field_18, category: :setup)).to be_present end end + + context "when the privacy notice is not accepted" do + it "cannot be nulled" do + expect(parser.errors[:field_18]).to eq(["You must show or give the buyer access to the MHCLG privacy notice before you can submit this log"]) + end + end end [