diff --git a/app/models/validations/tenancy_validations.rb b/app/models/validations/tenancy_validations.rb index b3f27b4f4..b24933a56 100644 --- a/app/models/validations/tenancy_validations.rb +++ b/app/models/validations/tenancy_validations.rb @@ -38,7 +38,7 @@ module Validations::TenancyValidations if record.hhmemb == 1 && record.joint != 2 && record.collection_start_year >= 2022 record.errors.add :joint, I18n.t("validations.tenancy.not_joint") - record.errors.add :hhmemb, I18n.t("validations.tenancy.not_joint") + record.errors.add :hhmemb, I18n.t("validations.tenancy.joint_more_than_one_member") end end end diff --git a/config/forms/2022_2023.json b/config/forms/2022_2023.json index a6cdee73e..df663cd0a 100644 --- a/config/forms/2022_2023.json +++ b/config/forms/2022_2023.json @@ -946,7 +946,7 @@ "header": "", "description": "", "questions": { - "joint_tenancy": { + "joint": { "check_answer_label": "Is this a joint tenancy?", "header": "Is this a joint tenancy?", "hint_text": "For example, 27 3 2021.", diff --git a/config/locales/en.yml b/config/locales/en.yml index bf0e0130c..fa6d731ff 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -222,6 +222,8 @@ en: internal_transfer: "Answer must be secure tenancy as you already told us this tenancy is an internal transfer" cannot_be_internal_transfer: "Answer cannot be internal transfer as you already told us this is not a secure tenancy" not_joint: "This cannot be a joint tenancy as you've told us there's only one person in the household" + joint_more_than_one_member: "There must be more than one person in the household as you've told us this is a joint tenancy" + declaration: missing: "You must show the DLUHC privacy notice to the tenant before you can submit this log." diff --git a/spec/models/validations/tenancy_validations_spec.rb b/spec/models/validations/tenancy_validations_spec.rb index 43e5e3542..db6c999f4 100644 --- a/spec/models/validations/tenancy_validations_spec.rb +++ b/spec/models/validations/tenancy_validations_spec.rb @@ -151,13 +151,14 @@ RSpec.describe Validations::TenancyValidations do context "when the data inputter has said that there is only one member in the household" do let(:record) { FactoryBot.create(:case_log, startdate: Time.zone.local(2022, 5, 1)) } let(:expected_error) { I18n.t("validations.tenancy.not_joint") } + let(:hhmemb_expected_error) { I18n.t("validations.tenancy.joint_more_than_one_member") } it "displays an error if the data inputter says the letting is a joint tenancy" do record.hhmemb = 1 record.joint = 1 tenancy_validator.validate_joint_tenancy(record) expect(record.errors["joint"]).to include(match(expected_error)) - expect(record.errors["hhmemb"]).to include(match(expected_error)) + expect(record.errors["hhmemb"]).to include(match(hhmemb_expected_error)) end it "does not display an error if the data inputter says the letting is not a joint tenancy" do