Browse Source

Merge branch 'main' into CLDC-510-income-ranges

pull/58/head
baarkerlounger 4 years ago
parent
commit
f943ebecbb
  1. 6
      app/models/case_log.rb
  2. 2
      config/forms/2021_2022.json
  3. 50
      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_net_income(record)
return unless record.tenant_economic_status && record.weekly_net_income

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",

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

@ -193,7 +193,7 @@
"summary": "Create New Case Log",
"operationId": "post-caselog",
"responses": {
"200": {
"201": {
"description": "Case Log Created",
"content": {
"application/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

@ -81,7 +81,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