diff --git a/app/models/validations/property_validations.rb b/app/models/validations/property_validations.rb index cfdb2b435..9011b0b44 100644 --- a/app/models/validations/property_validations.rb +++ b/app/models/validations/property_validations.rb @@ -59,12 +59,14 @@ module Validations::PropertyValidations record.errors.add :uprn, I18n.t("validations.lettings.property.uprn.not_in_england") record.errors.add :uprn_confirmation, I18n.t("validations.lettings.property.uprn_confirmation.not_in_england") record.errors.add :uprn_selection, I18n.t("validations.lettings.property.uprn_selection.not_in_england") + record.errors.add :startdate, I18n.t("validations.lettings.property.startdate.not_in_england") elsif record.is_supported_housing? return unless record.location return if record.location.location_code.in?(LocalAuthority.england.pluck(:code)) record.errors.add :location_id, I18n.t("validations.lettings.property.location_id.not_in_england") record.errors.add :scheme_id, I18n.t("validations.lettings.property.scheme_id.not_in_england") + record.errors.add :startdate, I18n.t("validations.lettings.property.startdate.not_in_england") end end end diff --git a/app/models/validations/sales/property_validations.rb b/app/models/validations/sales/property_validations.rb index 0c6ea1b67..569704862 100644 --- a/app/models/validations/sales/property_validations.rb +++ b/app/models/validations/sales/property_validations.rb @@ -46,5 +46,6 @@ module Validations::Sales::PropertyValidations record.errors.add :uprn, I18n.t("validations.sales.property_information.uprn.not_in_england") record.errors.add :uprn_confirmation, I18n.t("validations.sales.property_information.uprn_confirmation.not_in_england") record.errors.add :uprn_selection, I18n.t("validations.sales.property_information.uprn_selection.not_in_england") + record.errors.add :saledate, I18n.t("validations.sales.property_information.saledate.not_in_england") end end diff --git a/config/locales/validations/lettings/property_information.en.yml b/config/locales/validations/lettings/property_information.en.yml index 3a6e7fe5c..35866e42b 100644 --- a/config/locales/validations/lettings/property_information.en.yml +++ b/config/locales/validations/lettings/property_information.en.yml @@ -30,3 +30,5 @@ en: not_in_england: "It looks like you have selected a location with a local authority outside of England - only submit Lettings forms for Lettings that occur in England" location_id: not_in_england: "It looks like you have selected a location with a local authority outside of England - only submit Lettings forms for Lettings that occur in England" + startdate: + not_in_england: "It looks like you have selected a local authority outside of England - only submit Lettings forms for Lettings that occur in England" diff --git a/config/locales/validations/sales/property_information.en.yml b/config/locales/validations/sales/property_information.en.yml index 8bfefbd6d..2feb60982 100644 --- a/config/locales/validations/sales/property_information.en.yml +++ b/config/locales/validations/sales/property_information.en.yml @@ -34,3 +34,5 @@ en: not_in_england: "It looks like you have entered a UPRN for a local authority outside of England - only submit Sales forms for Sales that occur in England" uprn_selection: not_in_england: "It looks like you have selected an address for a local authority outside of England - only submit Sales forms for Sales that occur in England" + saledate: + not_in_england: "It looks like you have selected a local authority outside of England - only submit Sales forms for Sales that occur in England" diff --git a/spec/models/validations/property_validations_spec.rb b/spec/models/validations/property_validations_spec.rb index 247bc481a..82fa57223 100644 --- a/spec/models/validations/property_validations_spec.rb +++ b/spec/models/validations/property_validations_spec.rb @@ -221,6 +221,7 @@ RSpec.describe Validations::PropertyValidations do expect(log.errors["uprn"]).to include(I18n.t("validations.lettings.property.uprn.not_in_england")) expect(log.errors["uprn_confirmation"]).to include(I18n.t("validations.lettings.property.uprn_confirmation.not_in_england")) expect(log.errors["uprn_selection"]).to include(I18n.t("validations.lettings.property.uprn_selection.not_in_england")) + expect(log.errors["startdate"]).to include(I18n.t("validations.lettings.property.startdate.not_in_england")) expect(log.errors["scheme_id"]).to be_empty expect(log.errors["location_id"]).to be_empty end @@ -234,6 +235,7 @@ RSpec.describe Validations::PropertyValidations do property_validator.validate_la_in_england(log) expect(log.errors["scheme_id"]).to include(I18n.t("validations.lettings.property.scheme_id.not_in_england")) expect(log.errors["location_id"]).to include(I18n.t("validations.lettings.property.location_id.not_in_england")) + expect(log.errors["startdate"]).to include(I18n.t("validations.lettings.property.startdate.not_in_england")) expect(log.errors["la"]).to be_empty expect(log.errors["postcode_full"]).to be_empty expect(log.errors["uprn"]).to be_empty @@ -252,6 +254,7 @@ RSpec.describe Validations::PropertyValidations do expect(log.errors["uprn"]).to be_empty expect(log.errors["uprn_confirmation"]).to be_empty expect(log.errors["uprn_selection"]).to be_empty + expect(log.errors["startdate"]).to be_empty end end end diff --git a/spec/models/validations/sales/property_validations_spec.rb b/spec/models/validations/sales/property_validations_spec.rb index 83ef7c2c9..0fedd3fb0 100644 --- a/spec/models/validations/sales/property_validations_spec.rb +++ b/spec/models/validations/sales/property_validations_spec.rb @@ -159,6 +159,7 @@ RSpec.describe Validations::Sales::PropertyValidations do expect(log.errors["uprn"]).to include(I18n.t("validations.sales.property_information.uprn.not_in_england")) expect(log.errors["uprn_confirmation"]).to include(I18n.t("validations.sales.property_information.uprn_confirmation.not_in_england")) expect(log.errors["uprn_selection"]).to include(I18n.t("validations.sales.property_information.uprn_selection.not_in_england")) + expect(log.errors["saledate"]).to include(I18n.t("validations.sales.property_information.saledate.not_in_england")) end end @@ -172,6 +173,7 @@ RSpec.describe Validations::Sales::PropertyValidations do expect(log.errors["uprn"]).to be_empty expect(log.errors["uprn_confirmation"]).to be_empty expect(log.errors["uprn_selection"]).to be_empty + expect(log.errors["saledate"]).to be_empty end end end @@ -191,6 +193,7 @@ RSpec.describe Validations::Sales::PropertyValidations do expect(log.errors["uprn"]).to be_empty expect(log.errors["uprn_confirmation"]).to be_empty expect(log.errors["uprn_selection"]).to be_empty + expect(log.errors["saledate"]).to be_empty end end end