Browse Source

Remove extra radio questions from test json household section

pull/46/head
Kat 4 years ago committed by MadeTech Dushan
parent
commit
384a45c943
  1. 82
      config/forms/test_form.json
  2. 11
      spec/features/case_log_spec.rb
  3. 4
      spec/helpers/check_answers_helper_spec.rb

82
config/forms/test_form.json

@ -43,45 +43,6 @@
} }
} }
}, },
"tenant_ethnic_group": {
"questions": {
"tenant_ethnic_group": {
"check_answer_label": "Ethnicity",
"header": "What is the tenant's ethnic group?",
"type": "radio",
"answer_options": {
"0": "Other",
"1": "Prefer not to say"
}
}
}
},
"tenant_nationality": {
"questions": {
"tenant_nationality": {
"check_answer_label": "Nationality",
"header": "What is the tenant's nationality?",
"type": "radio",
"answer_options": {
"0": "UK",
"1": "Prefer not to say"
}
}
}
},
"tenant_economic_status": {
"questions": {
"tenant_economic_status": {
"check_answer_label": "Work",
"header": "Which of these best describes the tenant's working situation?",
"type": "radio",
"answer_options": {
"0": "Other",
"1": "Prefer not to say"
}
}
}
},
"household_number_of_other_members": { "household_number_of_other_members": {
"questions": { "questions": {
"household_number_of_other_members": { "household_number_of_other_members": {
@ -337,9 +298,7 @@
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"0": "All", "0": "All",
"1": "Some", "1": "Some"
"2": "None",
"3": "Do not know"
} }
} }
} }
@ -347,17 +306,12 @@
"housing_benefit": { "housing_benefit": {
"questions": { "questions": {
"housing_benefit": { "housing_benefit": {
"check_answer_label": "Universal Credit & Housing Benefit\t", "check_answer_label": "Universal Credit & Housing Benefit",
"header": "Is the tenant likely to be in receipt of any of these housing-related benefits?", "header": "Is the tenant likely to be in receipt of any of these housing-related benefits?",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"0": "Housing Benefit, but not Universal Credit", "0": "Housing Benefit, but not Universal Credit",
"1": "Universal Credit with housing element, but not Housing Benefit", "1": "Prefer not to say"
"2": "Universal Credit without housing element and no Housing Benefit",
"3": "Universal Credit and Housing Benefit",
"4": "Not Housing Benefit or Universal Credit",
"5": "Do not know",
"6": "Prefer not to say"
} }
} }
} }
@ -375,15 +329,7 @@
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"0": "Weekly for 52 weeks", "0": "Weekly for 52 weeks",
"1": "Fortnightly", "1": "Fortnightly"
"2": "Four-weekly",
"3": "Calendar monthly",
"4": "Weekly for 50 weeks",
"5": "Weekly for 49 weeks",
"6": "Weekly for 48 weeks",
"7": "Weekly for 47 weeks",
"8": "Weekly for 46 weeks",
"9": "Weekly for 53 weeks"
} }
}, },
"basic_rent": { "basic_rent": {
@ -454,26 +400,6 @@
"min": 0, "min": 0,
"step": 1, "step": 1,
"readonly": true "readonly": true
},
"outstanding_rent_or_charges": {
"check_answer_label": "After housing benefit and/or housing element of UC payment is received, will there be an outstanding amount for basic rent and/or benefit eligible charges?",
"header": "After housing benefit and/or housing element of UC payment is received, will there be an outstanding amount for basic rent and/or benefit eligible charges?",
"type": "radio",
"answer_options": {
"0": "Yes",
"1": "No"
},
"conditional_for": {
"outstanding_amount": ["Yes"]
}
},
"outstanding_amount": {
"check_answer_label": "Outstanding amount",
"header": "What do you expect the amount to be?",
"hint_text": "If the amount is unknown you can estimate",
"type": "numeric",
"min": 0,
"step": 1
} }
} }
} }

11
spec/features/case_log_spec.rb

@ -9,9 +9,6 @@ RSpec.describe "Test Features" do
tenant_code: { type: "text", answer: "BZ737" }, tenant_code: { type: "text", answer: "BZ737" },
tenant_age: { type: "numeric", answer: 25 }, tenant_age: { type: "numeric", answer: 25 },
tenant_gender: { type: "radio", answer: "Female" }, tenant_gender: { type: "radio", answer: "Female" },
tenant_ethnic_group: { type: "radio", answer: "Prefer not to say" },
tenant_nationality: { type: "radio", answer: "UK" },
tenant_economic_status: { type: "radio", answer: "Other" },
household_number_of_other_members: { type: "numeric", answer: 2 }, household_number_of_other_members: { type: "numeric", answer: 2 },
} }
@ -206,7 +203,7 @@ RSpec.describe "Test Features" do
it "has question headings based on the subsection" do it "has question headings based on the subsection" do
visit("case_logs/#{id}/#{subsection}/check_answers") visit("case_logs/#{id}/#{subsection}/check_answers")
question_labels = ["Tenant code", "Tenant's age", "Tenant's gender", "Ethnicity", "Nationality", "Work", "Number of Other Household Members"] question_labels = ["Tenant code", "Tenant's age", "Tenant's gender", "Number of Other Household Members"]
question_labels.each do |label| question_labels.each do |label|
expect(page).to have_content(label) expect(page).to have_content(label)
end end
@ -223,7 +220,7 @@ RSpec.describe "Test Features" do
it "should have an answer link for questions missing an answer" do it "should have an answer link for questions missing an answer" do
visit("case_logs/#{empty_case_log.id}/#{subsection}/check_answers") visit("case_logs/#{empty_case_log.id}/#{subsection}/check_answers")
assert_selector "a", text: /Answer\z/, count: 7 assert_selector "a", text: /Answer\z/, count: 4
assert_selector "a", text: "Change", count: 0 assert_selector "a", text: "Change", count: 0
expect(page).to have_link("Answer", href: "/case_logs/#{empty_case_log.id}/tenant_age") expect(page).to have_link("Answer", href: "/case_logs/#{empty_case_log.id}/tenant_age")
end end
@ -231,14 +228,14 @@ RSpec.describe "Test Features" do
it "should have a change link for answered questions" do it "should have a change link for answered questions" do
fill_in_number_question(empty_case_log.id, "tenant_age", 28) fill_in_number_question(empty_case_log.id, "tenant_age", 28)
visit("/case_logs/#{empty_case_log.id}/#{subsection}/check_answers") visit("/case_logs/#{empty_case_log.id}/#{subsection}/check_answers")
assert_selector "a", text: /Answer\z/, count: 6 assert_selector "a", text: /Answer\z/, count: 3
assert_selector "a", text: "Change", count: 1 assert_selector "a", text: "Change", count: 1
expect(page).to have_link("Change", href: "/case_logs/#{empty_case_log.id}/tenant_age") expect(page).to have_link("Change", href: "/case_logs/#{empty_case_log.id}/tenant_age")
end end
it "should have a link pointing to the first question if no questions are answered" do it "should have a link pointing to the first question if no questions are answered" do
visit("/case_logs/#{empty_case_log.id}/#{subsection}/check_answers") visit("/case_logs/#{empty_case_log.id}/#{subsection}/check_answers")
expect(page).to have_content("You answered 0 of 7 questions") expect(page).to have_content("You answered 0 of 4 questions")
expect(page).to have_link("Answer the missing questions", href: "/case_logs/#{empty_case_log.id}/tenant_code") expect(page).to have_link("Answer the missing questions", href: "/case_logs/#{empty_case_log.id}/tenant_code")
end end

4
spec/helpers/check_answers_helper_spec.rb

@ -63,7 +63,7 @@ RSpec.describe CheckAnswersHelper do
end end
it "ignores questions with unmet numeric conditions" do it "ignores questions with unmet numeric conditions" do
expect(total_number_of_questions(subsection_with_numeric_conditionals, case_log, form)).to eq(7) expect(total_number_of_questions(subsection_with_numeric_conditionals, case_log, form)).to eq(4)
end end
it "includes conditional questions with met numeric conditions" do it "includes conditional questions with met numeric conditions" do
@ -71,7 +71,7 @@ RSpec.describe CheckAnswersHelper do
subsection_with_numeric_conditionals, subsection_with_numeric_conditionals,
case_log_with_met_numeric_condition, case_log_with_met_numeric_condition,
form, form,
)).to eq(11) )).to eq(8)
end end
it "ignores questions with unmet radio conditions" do it "ignores questions with unmet radio conditions" do

Loading…
Cancel
Save