Browse Source

content changes and prevloc validation

pull/332/head
Kat 3 years ago
parent
commit
6b4429d502
  1. 6
      app/models/validations/household_validations.rb
  2. 2
      config/forms/2021_2022.json
  3. 1
      config/locales/en.yml
  4. 11
      spec/models/validations/household_validations_spec.rb

6
app/models/validations/household_validations.rb

@ -90,6 +90,12 @@ module Validations::HouseholdValidations
end
end
def validate_prevloc(record)
if record.previous_la_known == "Yes" && record.prevloc.blank?
record.errors.add :prevloc, I18n.t("validations.household.previous_la_known")
end
end
private
def women_of_child_bearing_age_in_household(record)

2
config/forms/2021_2022.json

@ -2687,7 +2687,7 @@
"description": "",
"questions": {
"previous_postcode_known": {
"header": "Do you know the property’s postcode?",
"header": "Do you know the postcode of the household’s last settled accommodation?",
"hint_text": "This is also known as the household’s ’last settled home’.",
"type": "radio",
"answer_options": {

1
config/locales/en.yml

@ -126,6 +126,7 @@ en:
internal_transfer: "Answer cannot be other homelessness as you already told us this tenancy was an internal transfer"
reasonpref:
not_homeless: "Can not be No if household was given reasonable preference"
previous_la_known: "Enter a local authority"
tenancy:

11
spec/models/validations/household_validations_spec.rb

@ -536,4 +536,15 @@ RSpec.describe Validations::HouseholdValidations do
end
end
end
describe "la validations" do
context "when previous la is known" do
it "prevloc has to be provided" do
record.previous_la_known = "Yes"
household_validator.validate_prevloc(record)
expect(record.errors["prevloc"])
.to include(match I18n.t("validations.household.previous_la_known"))
end
end
end
end

Loading…
Cancel
Save