Browse Source

Merge pull request #59 from communitiesuk/CLDC-477/reason-for-leaving-because-of-the-benefit-cap

Cldc 477/reason for leaving because of the benefit cap
pull/65/head
Matthew J. Phelan 3 years ago committed by GitHub
parent
commit
0527f97a4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/models/case_log.rb
  2. 2
      config/forms/2021_2022.json
  3. 48
      docs/api/DLUHC-CORE-Data.v1.json
  4. 9
      spec/models/case_log_spec.rb

6
app/models/case_log.rb

@ -39,6 +39,12 @@ class CaseLogValidator < ActiveModel::Validator
end
end
def validate_reason_for_leaving_last_settled_home(record)
if record.reason_for_leaving_last_settled_home == "Do not know" && record.benefit_cap_spare_room_subsidy != "Do not know"
record.errors.add :benefit_cap_spare_room_subsidy, "must be do not know if tenant’s main reason for leaving is do not know"
end
end
def validate_armed_forces_injured(record)
if (record.armed_forces == "Yes - a regular" || record.armed_forces == "Yes - a reserve") && record.armed_forces_injured.blank?
record.errors.add :armed_forces_injured, "You must answer the armed forces injury question if the tenant has served in the armed forces"

2
config/forms/2021_2022.json

@ -612,7 +612,7 @@
"header": "Leaving their last settled home",
"description": "",
"questions": {
"last_settled_home": {
"reason_for_leaving_last_settled_home": {
"header": "What is the tenant’s main reason for leaving?",
"hint_text": "",
"type": "radio",

48
docs/api/DLUHC-CORE-Data.v1.json

@ -781,11 +781,55 @@
},
"reason_for_leaving_last_settled_home": {
"type": "string",
"minLength": 1
"minLength": 1,
"enum": [
"Permanently decanted from another property owned by this landlord",
"Left home country as a refugee",
"Loss of tied accommodation",
"Domestic abuse",
"(Non violent) relationship breakdown with partner",
"Asked to leave by family or friends",
"Racial harassment",
"Other problems with neighbours",
"Property unsuitable because of overcrowding",
"End of assured shorthold tenancy - no fault",
"End of assured shorthold tenancy - tenant's fault",
"End of fixed term tenancy - no fault",
"End of fixed term tenancy - tenant's fault",
"Repossession",
"Under occupation - offered incentive to downsize",
"Under occupation - no incentive",
"Property unsuitable because of ill health / disability",
"Property unsuitable because of poor condition",
"Couldn't afford fees attached to renewing the tenancy",
"Couldn't afford increase in rent",
"Couldn't afford rent or mortgage - welfare reforms",
"Couldn't afford rent or mortgage - employment",
"Couldn't afford rent or mortgage - other",
"To move nearer to family / friends / school",
"To move nearer to work",
"To move to accomodation with support",
"To move to independent accomodation",
"Hate crime",
"Death of household member in last settled accomodation",
"Discharged from prison",
"Discharged from long stay hospital or similar institution",
"Other",
"Do not know",
"Prefer not to say"
]
},
"benefit_cap_spare_room_subsidy": {
"type": "string",
"minLength": 1
"minLength": 1,
"enum": [
"Yes - benefit cap",
"Yes - removal of the spare room subsidy",
"Yes - both the benefit cap and the removal of the spare room subsidy",
"No",
"Do not know",
"Prefer not to say"
]
},
"armed_forces_active": {
"type": "string",

9
spec/models/case_log_spec.rb

@ -57,7 +57,14 @@ RSpec.describe Form, type: :model do
}.to raise_error(ActiveRecord::RecordInvalid)
end
end
context "reason for leaving last settled home validation" do
it "Reason for leaving must be don't know if reason for leaving settled home (Q9a) is don't know." do
expect {
CaseLog.create!(reason_for_leaving_last_settled_home: "Do not know",
benefit_cap_spare_room_subsidy: "Yes - benefit cap")
}.to raise_error(ActiveRecord::RecordInvalid)
end
end
context "other reason for leaving last settled home validation" do
it "must be provided if main reason for leaving last settled home was given as other" do
expect {

Loading…
Cancel
Save