Browse Source

CLDC-2175 Remove option for renewals (#1483)

* feat: add webform validation

* feat: copy updates

* feat: disable toggles

* feat: enable toggles

* feat: disable toggles

* feat: enable toggles

* feat: add test

* refactor: typo
new-year-bulk-fixes
natdeanlewissoftwire 2 years ago committed by GitHub
parent
commit
2f54e874b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      app/models/validations/household_validations.rb
  2. 3
      config/locales/en.yml
  3. 12
      spec/models/validations/household_validations_spec.rb

9
app/models/validations/household_validations.rb

@ -112,6 +112,15 @@ module Validations::HouseholdValidations
end end
end end
def validate_layear(record)
return unless record.layear && record.renewal
if record.is_renewal? && record.layear == 1
record.errors.add :layear, I18n.t("validations.household.renewal_just_moved_to_area.layear")
record.errors.add :renewal, I18n.t("validations.household.renewal_just_moved_to_area.renewal")
end
end
private private
def household_no_illness?(record) def household_no_illness?(record)

3
config/locales/en.yml

@ -416,6 +416,9 @@ en:
reasonpref: reasonpref:
not_homeless: "Answer cannot be ‘no’ as the tenant was homeless or about to lose their home" not_homeless: "Answer cannot be ‘no’ as the tenant was homeless or about to lose their home"
previous_la_known: "Enter name of local authority" previous_la_known: "Enter name of local authority"
renewal_just_moved_to_area:
layear: 'The household cannot have just moved to the local authority area if this letting is a renewal'
renewal: 'This letting cannot be a renewal if the household has just moved to the local authority area'
gender: gender:
retired_male: "Answer cannot be ‘male’ as tenant is under 65 and retired" retired_male: "Answer cannot be ‘male’ as tenant is under 65 and retired"
retired_female: "Answer cannot be ‘female’ as tenant is under 60 and retired" retired_female: "Answer cannot be ‘female’ as tenant is under 60 and retired"

12
spec/models/validations/household_validations_spec.rb

@ -566,6 +566,18 @@ RSpec.describe Validations::HouseholdValidations do
.to include(match I18n.t("validations.household.previous_la_known")) .to include(match I18n.t("validations.household.previous_la_known"))
end end
end end
context "when validating layear" do
it "household cannot have just moved to area if renewal" do
record.layear = 1
record.renewal = 1
household_validator.validate_layear(record)
expect(record.errors["layear"])
.to include(match I18n.t("validations.household.renewal_just_moved_to_area.layear"))
expect(record.errors["renewal"])
.to include(match I18n.t("validations.household.renewal_just_moved_to_area.renewal"))
end
end
end end
describe "previous housing situation validations" do describe "previous housing situation validations" do

Loading…
Cancel
Save