From 3ba0b4d60c4ab95157e3b85e4003aa4049b64459 Mon Sep 17 00:00:00 2001 From: MadeTech Dushan Date: Fri, 18 Feb 2022 16:09:17 +0000 Subject: [PATCH] content updates to form --- app/models/constants/case_log.rb | 6 +++--- .../validations/household_validations.rb | 4 ++-- config/forms/2021_2022.json | 21 ++++++++----------- docs/api/DLUHC-CORE-Data.v1.json | 2 +- spec/fixtures/complete_case_log.json | 4 ++-- spec/fixtures/forms/2021_2022.json | 6 +++--- .../conditional_questions_helper_spec.rb | 2 +- .../validations/household_validations_spec.rb | 10 ++++----- 8 files changed, 26 insertions(+), 29 deletions(-) diff --git a/app/models/constants/case_log.rb b/app/models/constants/case_log.rb index 4a4558f76..9985120de 100644 --- a/app/models/constants/case_log.rb +++ b/app/models/constants/case_log.rb @@ -99,7 +99,7 @@ module Constants::CaseLog PREGNANCY = { "Yes" => 1, "No" => 2, - "Prefer not to say" => 3, + "Tenant prefers not to say" => 3, }.freeze PREVIOUS_TENANCY = { @@ -980,10 +980,10 @@ module Constants::CaseLog }.freeze ARMED_FORCES = { - "Yes, the tenant is a current or former regular" => 1, + "Yes, the person is a current or former regular" => 1, "No" => 2, "Person prefers not to say" => 3, - "Yes, the tenant is a current or former reserve" => 4, + "Yes, the person is a current or former reserve" => 4, "Yes, the tenant is a spouse or civil partner of a UK armed forces member and has been bereaved or separated from them within the last 2 years" => 5, }.freeze diff --git a/app/models/validations/household_validations.rb b/app/models/validations/household_validations.rb index 40f04e861..58997fb9d 100644 --- a/app/models/validations/household_validations.rb +++ b/app/models/validations/household_validations.rb @@ -27,13 +27,13 @@ module Validations::HouseholdValidations if (record.armedforces == "No" || record.armedforces == "Person prefers not to say") && record.reservist.present? record.errors.add :reservist, I18n.t("validations.household.reservist.injury_not_required") end - if record.armedforces != "Yes, the tenant is a current or former regular" && record.leftreg.present? + if record.armedforces != "Yes, the person is a current or former regular" && record.leftreg.present? record.errors.add :leftreg, I18n.t("validations.household.leftreg.question_not_required") end end def validate_pregnancy(record) - if (record.preg_occ == "Yes" || record.preg_occ == "Prefer not to say") && !women_of_child_bearing_age_in_household(record) + if (record.preg_occ == "Yes" || record.preg_occ == "Tenant prefers not to say") && !women_of_child_bearing_age_in_household(record) record.errors.add :preg_occ, I18n.t("validations.household.preg_occ.no_female") end end diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 6493c94a3..f228a9ce9 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -2056,18 +2056,18 @@ "questions": { "armedforces": { "header": "Does anybody in the household have any links to the UK armed forces?", - "hint_text": "This excludes national service. If there are several people in the household with links to the UK armed forces, you should answer for the regular. If there’s no regular, answer for the reserve. If there’s no reserve, answer for the spouse or civil partner.", + "hint_text": "This excludes national service.
If there are several people in the household with links to the UK armed forces, you should answer for the regular. If there’s no regular, answer for the reserve. If there’s no reserve, answer for the spouse or civil partner.", "type": "radio", "check_answer_label": "Household links to UK armed forces", "answer_options": { "0": { - "value": "Yes, the tenant is a current or former regular" + "value": "Yes, the person is a current or former regular" }, "1": { - "value": "Yes, the tenant is a current or former reserve" + "value": "Yes, the person is a current or former reserve" }, "2": { - "value": "Yes, the tenant is a spouse or civil partner of a UK armed forces member and has been bereaved or separated from them within the last 2 years" + "value": "Yes, the person is a spouse or civil partner of a UK armed forces member and has been bereaved or separated from them within the last 2 years" }, "3": { "value": "No" @@ -2084,7 +2084,7 @@ "description": "", "depends_on": [ { - "armedforces": "Yes, the tenant is a current or former regular" + "armedforces": "Yes, the person is a current or former regular" } ], "questions": { @@ -2111,14 +2111,14 @@ } }, "armed_forces_reservist": { - "header": "Experience of the UK Armed Forces", + "header": "", "description": "", "depends_on": [ { - "armedforces": "Yes, the tenant is a current or former regular" + "armedforces": "Yes, the person is a current or former regular" }, { - "armedforces": "Yes, the tenant is a current or former reserve" + "armedforces": "Yes, the person is a current or former reserve" } ], "questions": { @@ -2157,11 +2157,8 @@ "1": { "value": "No" }, - "divider": { - "value": true - }, "2": { - "value": "Prefer not to say" + "value": "Tenant prefers not to say" } } } diff --git a/docs/api/DLUHC-CORE-Data.v1.json b/docs/api/DLUHC-CORE-Data.v1.json index 7db56b794..308220f9a 100644 --- a/docs/api/DLUHC-CORE-Data.v1.json +++ b/docs/api/DLUHC-CORE-Data.v1.json @@ -261,7 +261,7 @@ "ethnic": "White: English, Welsh, Scottish, Northern Irish or British", "national": "UK national resident in UK", "prevten": "Private sector tenancy", - "armedforces": "Yes, the tenant is a current or former regular", + "armedforces": "Yes, the person is a current or former regular", "ecstat1": "Full-time - 30 hours or more", "other_hhmemb": 7, "relat2": "Partner", diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json index 95ca48606..cc734901c 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -6,8 +6,8 @@ "ethnic": "White: English, Welsh, Scottish, Northern Irish or British", "national": "UK national resident in UK", "prevten": "Private sector tenancy", - "armedforces": "Yes, the tenant is a current or former regular", - "armed_forces": "Yes, the tenant is a current or former regular", + "armedforces": "Yes, the person is a current or former regular", + "armed_forces": "Yes, the person is a current or former regular", "armed_forces_partner": "", "ecstat1": "Full-time - 30 hours or more", "other_hhmemb": 7, diff --git a/spec/fixtures/forms/2021_2022.json b/spec/fixtures/forms/2021_2022.json index 3c14083a5..612bd411d 100644 --- a/spec/fixtures/forms/2021_2022.json +++ b/spec/fixtures/forms/2021_2022.json @@ -162,10 +162,10 @@ "check_answer_label": "Household links to UK armed forces", "answer_options": { "0": { - "value": "Yes, the tenant is a current or former regular" + "value": "Yes, the person is a current or former regular" }, "1": { - "value": "Yes, the tenant is a current or former reserve" + "value": "Yes, the person is a current or former reserve" }, "2": { "value": "Yes, the tenant is a spouse or civil partner of a UK armed forces member and has been bereaved or separated from them within the last 2 years" @@ -178,7 +178,7 @@ } }, "conditional_for": { - "leftreg": ["Yes, the tenant is a current or former regular"] + "leftreg": ["Yes, the person is a current or former regular"] } }, "leftreg": { diff --git a/spec/helpers/conditional_questions_helper_spec.rb b/spec/helpers/conditional_questions_helper_spec.rb index ae5b80921..3f70ec057 100644 --- a/spec/helpers/conditional_questions_helper_spec.rb +++ b/spec/helpers/conditional_questions_helper_spec.rb @@ -14,7 +14,7 @@ RSpec.describe ConditionalQuestionsHelper do describe "find conditional question" do let(:question) { page.questions.find { |q| q.id == "armedforces" } } - let(:answer_value) { "Yes, the tenant is a current or former regular" } + let(:answer_value) { "Yes, the person is a current or former regular" } it "returns the conditional question for a given answer option" do expect(find_conditional_question(page, question, answer_value).id).to eq("leftreg") diff --git a/spec/models/validations/household_validations_spec.rb b/spec/models/validations/household_validations_spec.rb index be768cb07..423b9c412 100644 --- a/spec/models/validations/household_validations_spec.rb +++ b/spec/models/validations/household_validations_spec.rb @@ -122,7 +122,7 @@ RSpec.describe Validations::HouseholdValidations do end it "validates that pregnancy cannot be prefer not to say" do - record.preg_occ = "Prefer not to say" + record.preg_occ = "Tenant prefers not to say" record.sex1 = "Male" household_validator.validate_pregnancy(record) expect(record.errors["preg_occ"]) @@ -254,7 +254,7 @@ RSpec.describe Validations::HouseholdValidations do context "when the tenant was or is a regular member of the armed forces" do it "expects that injured in the armed forces can be yes" do - record.armedforces = "Yes, the tenant is a current or former regular" + record.armedforces = "Yes, the person is a current or former regular" record.reservist = "Yes" household_validator.validate_armed_forces(record) expect(record.errors["reservist"]).to be_empty @@ -263,7 +263,7 @@ RSpec.describe Validations::HouseholdValidations do context "when the tenant was or is a reserve member of the armed forces" do it "expects that injured in the armed forces can be yes" do - record.armedforces = "Yes, the tenant is a current or former reserve" + record.armedforces = "Yes, the person is a current or former reserve" record.reservist = "Yes" household_validator.validate_armed_forces(record) expect(record.errors["reservist"]).to be_empty @@ -289,14 +289,14 @@ RSpec.describe Validations::HouseholdValidations do end it "expects that they served in the armed forces" do - record.armedforces = "Yes, the tenant is a current or former regular" + record.armedforces = "Yes, the person is a current or former regular" record.leftreg = "Yes" household_validator.validate_armed_forces(record) expect(record.errors["leftreg"]).to be_empty end it "expects that they served in the armed forces and may have been injured" do - record.armedforces = "Yes, the tenant is a current or former regular" + record.armedforces = "Yes, the person is a current or former regular" record.leftreg = "Yes" record.reservist = "Yes" household_validator.validate_armed_forces(record)