From dafb556a1b96702d390bbed4945a2898836fa185 Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 8 Aug 2022 10:18:25 +0100 Subject: [PATCH] update error messages for hard validations --- app/models/validations/date_validations.rb | 2 +- config/locales/en.yml | 5 ++++- spec/models/validations/date_validations_spec.rb | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/models/validations/date_validations.rb b/app/models/validations/date_validations.rb index 946cfa6c2..6351a712b 100644 --- a/app/models/validations/date_validations.rb +++ b/app/models/validations/date_validations.rb @@ -10,7 +10,7 @@ module Validations::DateValidations end if record["mrcdate"].present? && record["startdate"].present? && record["startdate"].to_date - record["mrcdate"].to_date > 3650 - record.errors.add :mrcdate, I18n.t("validations.property.mrcdate.730_days_before_tenancy_start") + record.errors.add :mrcdate, I18n.t("validations.property.mrcdate.ten_years_before_tenancy_start") end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 56b70d397..fdb243b5f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -122,7 +122,7 @@ en: mrcdate: before_tenancy_start: "Enter a major repairs date that is before the tenancy start date" not_first_let: "Major repairs date must not be completed if the tenancy is a first let" - 730_days_before_tenancy_start: "Enter a major repairs completion date that is no more than 730 days before the tenancy start date" + ten_years_before_tenancy_start: "Enter a major repairs completion date that is no more than 10 years before the tenancy start date" void_date: ten_years_before_tenancy_start: "Enter a void date must no more than 10 years before the tenancy start date" before_tenancy_start: "Enter a void date must that is before the tenancy start date" @@ -319,6 +319,9 @@ en: title: "You told us somebody in the household is pregnant" no_females: "You also told us there are no female tenants living at the property." females_not_in_soft_age_range: "You also told us that any female tenants living at the property are in the following age ranges:" + major_repairs_date: + title_text: "You told us the time between the start of the tenancy and the major repairs completion date is more than 730 days" + hint_text: "Are you sure the time between these dates is correct?" devise: two_factor_authentication: diff --git a/spec/models/validations/date_validations_spec.rb b/spec/models/validations/date_validations_spec.rb index fcee95189..3370f9cc0 100644 --- a/spec/models/validations/date_validations_spec.rb +++ b/spec/models/validations/date_validations_spec.rb @@ -90,7 +90,7 @@ RSpec.describe Validations::DateValidations do record.mrcdate = Time.zone.local(2012, 1, 1) date_validator.validate_property_major_repairs(record) expect(record.errors["mrcdate"]) - .to include(match I18n.t("validations.property.mrcdate.730_days_before_tenancy_start")) + .to include(match I18n.t("validations.property.mrcdate.ten_years_before_tenancy_start")) end it "must be within 10 years of the tenancy start date" do