From 0272b4b1e0d1f8924d7832fd5f3efccc402684ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Meny?= Date: Wed, 20 Apr 2022 16:25:33 +0100 Subject: [PATCH] Fix tests related to illness --- app/models/form/question.rb | 2 +- spec/factories/case_log.rb | 2 +- spec/features/form/check_answers_page_spec.rb | 4 ++-- spec/fixtures/complete_case_log.json | 2 +- spec/fixtures/exports/case_logs.xml | 2 +- spec/fixtures/forms/2021_2022.json | 12 +++--------- spec/models/form/question_spec.rb | 10 +++++----- 7 files changed, 14 insertions(+), 20 deletions(-) diff --git a/app/models/form/question.rb b/app/models/form/question.rb index 67ce69d9f..5657beaf0 100644 --- a/app/models/form/question.rb +++ b/app/models/form/question.rb @@ -283,6 +283,7 @@ private hb: [5], benefits: [3], unitletas: [3], + illness: [3], }.freeze RADIO_REFUSED_VALUE = { @@ -314,7 +315,6 @@ private leftreg: [3], reservist: [2], preg_occ: [3], - illness: [3], hb: [6], }.freeze end diff --git a/spec/factories/case_log.rb b/spec/factories/case_log.rb index a97c13488..ce2dfaf90 100644 --- a/spec/factories/case_log.rb +++ b/spec/factories/case_log.rb @@ -49,7 +49,7 @@ FactoryBot.define do underoccupation_benefitcap { 0 } leftreg { 1 } reservist { 0 } - illness { 0 } + illness { 1 } preg_occ { 2 } tenancy_code { "BZ757" } startertenancy { 0 } diff --git a/spec/features/form/check_answers_page_spec.rb b/spec/features/form/check_answers_page_spec.rb index c51e2c1e6..523e43038 100644 --- a/spec/features/form/check_answers_page_spec.rb +++ b/spec/features/form/check_answers_page_spec.rb @@ -166,7 +166,7 @@ RSpec.describe "Form Check Answers Page" do sex1: "M", hhmemb: 1, armedforces: 3, - illness: 0, + illness: 1, ) end @@ -181,7 +181,7 @@ RSpec.describe "Form Check Answers Page" do sex1: "M", hhmemb: 1, armedforces: 3, - illness: 0, + illness: 1, housingneeds_h: 1, la: "E06000014", illness_type_1: 1, diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json index 3ae9153c1..d32fe927f 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -42,7 +42,7 @@ "underoccupation_benefitcap": 0, "leftreg": 1, "reservist": 0, - "illness": 0, + "illness": 1, "preg_occ": 1, "tenancy_code": "BZ757", "startdate": "12/12/2021", diff --git a/spec/fixtures/exports/case_logs.xml b/spec/fixtures/exports/case_logs.xml index df072b6cb..a5dd626af 100644 --- a/spec/fixtures/exports/case_logs.xml +++ b/spec/fixtures/exports/case_logs.xml @@ -38,7 +38,7 @@ 0 1 0 - 0 + 1 2 BZ757 0 diff --git a/spec/fixtures/forms/2021_2022.json b/spec/fixtures/forms/2021_2022.json index 032448ca1..18ebd9033 100644 --- a/spec/fixtures/forms/2021_2022.json +++ b/spec/fixtures/forms/2021_2022.json @@ -260,20 +260,14 @@ "type": "radio", "check_answer_label": "Physical, mental health or illness in the household", "answer_options": { - "0": { - "value": "Yes" - }, "1": { - "value": "No" - }, - "divider": { - "value": true + "value": "Yes" }, "2": { - "value": "Don’t know" + "value": "No" }, "3": { - "value": "Prefer not to say" + "value": "Don’t know" } } } diff --git a/spec/models/form/question_spec.rb b/spec/models/form/question_spec.rb index 13b2d7c1a..0ab55f431 100644 --- a/spec/models/form/question_spec.rb +++ b/spec/models/form/question_spec.rb @@ -94,11 +94,11 @@ RSpec.describe Form::Question, type: :model do let(:question_id) { "illness" } it "maps those options" do - expect(question).to be_value_is_yes(0) - expect(question).not_to be_value_is_no(0) - expect(question).not_to be_value_is_refused(0) - expect(question).to be_value_is_no(1) - expect(question).to be_value_is_refused(2) + expect(question).to be_value_is_yes(1) + expect(question).not_to be_value_is_no(1) + expect(question).not_to be_value_is_refused(1) + expect(question).to be_value_is_no(2) + expect(question).to be_value_is_dont_know(3) end end