Browse Source

CLDC-4046: Remove forcing on Q84 based on Q76 answer (#3094)

* CLDC-4046: Remove forcing on Q84 based on Q76 answer

* CLDC-4046: Removing forcing on latter half of Q84 as well

* CLDC-4046: Remove orphaned translations

* CLDC-4086: Fix tests
pull/3112/head
Samuel Young 4 weeks ago committed by GitHub
parent
commit
ca72558c7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 11
      app/models/validations/household_validations.rb
  2. 7
      config/locales/validations/lettings/household.en.yml
  3. 8
      spec/models/validations/household_validations_spec.rb

11
app/models/validations/household_validations.rb

@ -30,17 +30,6 @@ module Validations::HouseholdValidations
end
validate_other_field(record, 20, :reason, :reasonother)
if record.is_reason_permanently_decanted?
if record.referral_type.present? && !record.is_from_prp_only_housing_register_or_waiting_list?
record.errors.add :referral_type, I18n.t("validations.lettings.household.referral_type.leaving_last_settled_home.reason_permanently_decanted")
end
if record.referral.present? && !record.is_internal_transfer?
record.errors.add :referral, I18n.t("validations.lettings.household.referral.leaving_last_settled_home.reason_permanently_decanted")
record.errors.add :reason, I18n.t("validations.lettings.household.reason.leaving_last_settled_home.not_internal_transfer")
end
end
return unless record.form.start_year_2024_or_later?
if record.reason == 20 && PHRASES_INDICATING_HOMELESSNESS_REGEX.match?(record.reasonother)

7
config/locales/validations/lettings/household.en.yml

@ -28,7 +28,6 @@ en:
reason:
leaving_last_settled_home:
dont_know_required: "Answer must be ‘don’t know’ as you told us you don’t know the tenant’s main reason for leaving."
not_internal_transfer: "Answer cannot be ‘permanently decanted from another property owned by this landlord’ as you told us the source of referral for this tenancy was not an internal transfer."
other_not_settled: "Please give the reason for the tenant leaving their last settled home. This is where they were living before they became homeless, were living in temporary accommodation or sleeping rough."
condition_effects:
@ -102,11 +101,5 @@ en:
referral:
prevten_invalid: "Answer cannot be internal transfer as the household situation immediately before this letting was %{prevten}."
leaving_last_settled_home:
reason_permanently_decanted: "Answer must be internal transfer as the tenant was permanently decanted from another property owned by this landlord."
la_general_needs:
internal_transfer: "Answer cannot be internal transfer as it’s the same landlord on the tenancy agreement and the household had either a fixed-term or lifetime local authority general needs tenancy immediately before this letting."
referral_type:
leaving_last_settled_home:
reason_permanently_decanted: "Answer must be from a PRP-only housing register or waiting list (no local authority involvement) as the tenant was permanently decanted from another property owned by this landlord."

8
spec/models/validations/household_validations_spec.rb

@ -116,17 +116,17 @@ RSpec.describe Validations::HouseholdValidations do
end
context "when referral is not internal transfer" do
it "cannot be permanently decanted from another property owned by this landlord" do
it "can be permanently decanted from another property owned by this landlord" do
record.reason = 1
record.referral_type = 1
record.referral = 2
household_validator.validate_reason_for_leaving_last_settled_home(record)
expect(record.errors["reason"])
.to include(match(I18n.t("validations.lettings.household.reason.leaving_last_settled_home.not_internal_transfer")))
.to be_empty
expect(record.errors["referral"])
.to include(match(I18n.t("validations.lettings.household.referral.leaving_last_settled_home.reason_permanently_decanted")))
.to be_empty
expect(record.errors["referral_type"])
.to include(match(I18n.t("validations.lettings.household.referral_type.leaving_last_settled_home.reason_permanently_decanted")))
.to be_empty
end
end

Loading…
Cancel
Save