Browse Source

Fix tests related to illness

pull/470/head
Stéphane Meny 4 years ago
parent
commit
0272b4b1e0
No known key found for this signature in database
GPG Key ID: 9D0AFEA988527923
  1. 2
      app/models/form/question.rb
  2. 2
      spec/factories/case_log.rb
  3. 4
      spec/features/form/check_answers_page_spec.rb
  4. 2
      spec/fixtures/complete_case_log.json
  5. 2
      spec/fixtures/exports/case_logs.xml
  6. 12
      spec/fixtures/forms/2021_2022.json
  7. 10
      spec/models/form/question_spec.rb

2
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

2
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 }

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

2
spec/fixtures/complete_case_log.json vendored

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

2
spec/fixtures/exports/case_logs.xml vendored

@ -38,7 +38,7 @@
<underoccupation_benefitcap>0</underoccupation_benefitcap>
<leftreg>1</leftreg>
<reservist>0</reservist>
<illness>0</illness>
<illness>1</illness>
<preg_occ>2</preg_occ>
<tenancy_code>BZ757</tenancy_code>
<startertenancy>0</startertenancy>

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

@ -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"
}
}
}

10
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

Loading…
Cancel
Save