Browse Source

update benefit question options

pull/213/head
Kat 4 years ago
parent
commit
52f82f4a72
  1. 8
      app/models/constants/case_log.rb
  2. 2
      app/models/validations/financial_validations.rb
  3. 12
      config/forms/2021_2022.json
  4. 2
      docs/api/DLUHC-CORE-Data.v1.json
  5. 2
      spec/factories/case_log.rb
  6. 2
      spec/features/form/helpers.rb
  7. 2
      spec/fixtures/complete_case_log.json
  8. 4
      spec/fixtures/forms/2021_2022.json
  9. 6
      spec/models/case_log_spec.rb

8
app/models/constants/case_log.rb

@ -198,10 +198,10 @@ module Constants::CaseLog
}.freeze
BENEFITS = {
"All" => 1,
"Some" => 2,
"None" => 3,
"Don’t know" => 4,
"1. All" => 1,
"2. Some" => 2,
"3. None" => 3,
"4. Don’t know" => 4,
}.freeze
PERIOD = {

2
app/models/validations/financial_validations.rb

@ -17,7 +17,7 @@ module Validations::FinancialValidations
is_employed = EMPLOYED_STATUSES.include?(economic_status)
relationship = record["relat#{n}"]
is_partner_or_main = relationship == "Partner" || (relationship.nil? && economic_status.present?)
if is_employed && is_partner_or_main && record.benefits == "All"
if is_employed && is_partner_or_main && record.benefits == "1. All"
record.errors.add :benefits, "income is from Universal Credit, state pensions or benefits cannot be All if the tenant or the partner works part or full time"
end
end

12
config/forms/2021_2022.json

@ -1937,15 +1937,15 @@
"questions": {
"benefits": {
"check_answer_label": "Benefits as a proportion of income",
"header": "How much of the tenant’s income is from Universal Credit, state pensions or benefits?",
"hint_text": "",
"header": "How much of the household's income is from Universal Credit, state pensions or benefits?",
"hint_text": "This excludes child and housing benefit, council tax support and tax credits.",
"type": "radio",
"answer_options": {
"0": "All",
"1": "Some",
"2": "None",
"0": "1. All",
"1": "2. Some",
"2": "3. None",
"divider": true,
"3": "Don’t know"
"3": "4. Don’t know"
}
}
}

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

@ -322,7 +322,7 @@
"wchair": true,
"earnings": 1000,
"incfreq": "Monthly",
"benefits": "Some",
"benefits": "2. Some",
"hb": "6. Universal Credit with housing element (excluding housing benefit)",
"period": "Weekly",
"brent": 200,

2
spec/factories/case_log.rb

@ -71,7 +71,7 @@ FactoryBot.define do
offered { 2 }
wchair { "Yes" }
earnings { 68 }
benefits { "Some" }
benefits { "2. Some" }
period { "Fortnightly" }
brent { 200 }
scharge { 50 }

2
spec/features/form/helpers.rb

@ -10,7 +10,7 @@ module Helpers
fill_in("case-log-earnings-field", with: 18_000)
choose("case-log-incfreq-yearly-field")
click_button("Save and continue")
choose("case-log-benefits-all-field")
choose("case-log-benefits-1-all-field")
click_button("Save and continue")
choose("case-log-hb-10-tenant-prefers-not-to-say-field")
click_button("Save and continue")

2
spec/fixtures/complete_case_log.json vendored

@ -76,7 +76,7 @@
"wchair": "Yes",
"net_income_known": "Yes – the household has a weekly income",
"earnings": 150,
"benefits": "Some",
"benefits": "2. Some",
"hb": "6. Universal Credit with housing element (excluding housing benefit)",
"period": "Fortnightly",
"brent": 200,

4
spec/fixtures/forms/2021_2022.json vendored

@ -404,8 +404,8 @@
"header": "How much of the tenant’s income is from Universal Credit, state pensions or benefits?",
"type": "radio",
"answer_options": {
"0": "All",
"1": "Some"
"0": "1. All",
"1": "2. Some"
}
}
}

6
spec/models/case_log_spec.rb

@ -408,7 +408,7 @@ RSpec.describe Form, type: :model do
it "Cannot be All if person 1 works full time" do
expect {
CaseLog.create!(
benefits: "All",
benefits: "1. All",
ecstat1: "Full-time - 30 hours or more",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
@ -419,7 +419,7 @@ RSpec.describe Form, type: :model do
it "Cannot be All if person 1 works part time" do
expect {
CaseLog.create!(
benefits: "All",
benefits: "1. All",
ecstat1: "Part-time - Less than 30 hours",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
@ -430,7 +430,7 @@ RSpec.describe Form, type: :model do
it "Cannot be 1 All if any of persons 2-4 are person 1's partner and work part or full time" do
expect {
CaseLog.create!(
benefits: "All",
benefits: "1. All",
relat2: "Partner",
ecstat2: "Part-time - Less than 30 hours",
owning_organisation: owning_organisation,

Loading…
Cancel
Save