|
|
|
@ -15,6 +15,18 @@ RSpec.describe "Test Features" do
|
|
|
|
|
household_number_of_other_members: { type: "numeric", answer: 2 }, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
def answer_all_questions_in_income_subsection |
|
|
|
|
visit("/case_logs/#{empty_case_log.id}/net_income") |
|
|
|
|
fill_in("net_income", with: 18_000) |
|
|
|
|
choose("net-income-frequency-yearly-field") |
|
|
|
|
click_button("Save and continue") |
|
|
|
|
choose("net-income-uc-proportion-all-field") |
|
|
|
|
click_button("Save and continue") |
|
|
|
|
choose("housing-benefit-housing-benefit-but-not-universal-credit-field") |
|
|
|
|
click_button("Save and continue") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "Create new log" do |
|
|
|
|
it "redirects to the task list for the new log" do |
|
|
|
|
visit("/case_logs") |
|
|
|
@ -44,6 +56,17 @@ RSpec.describe "Test Features" do
|
|
|
|
|
visit("/case_logs/#{empty_case_log.id}") |
|
|
|
|
expect(page).to have_link("Skip to next incomplete section", :href => /#household_characteristics/) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "shows the number of completed sections if no sections are completed" do |
|
|
|
|
visit("/case_logs/#{empty_case_log.id}") |
|
|
|
|
expect(page).to have_content("You've completed 0 of 9 sections.") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "shows the number of completed sections if one section is completed" do |
|
|
|
|
answer_all_questions_in_income_subsection |
|
|
|
|
visit("/case_logs/#{empty_case_log.id}") |
|
|
|
|
expect(page).to have_content("You've completed 1 of 9 sections.") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "displays the household questions when you click into that section" do |
|
|
|
@ -123,17 +146,6 @@ RSpec.describe "Test Features" do
|
|
|
|
|
click_button("Save and continue") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def answer_all_questions_in_income_subsection |
|
|
|
|
visit("/case_logs/#{empty_case_log.id}/net_income") |
|
|
|
|
fill_in("net_income", with: 18_000) |
|
|
|
|
choose("net-income-frequency-yearly-field") |
|
|
|
|
click_button("Save and continue") |
|
|
|
|
choose("net-income-uc-proportion-all-field") |
|
|
|
|
click_button("Save and continue") |
|
|
|
|
choose("housing-benefit-housing-benefit-but-not-universal-credit-field") |
|
|
|
|
click_button("Save and continue") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "can be visited by URL" do |
|
|
|
|
visit("case_logs/#{id}/#{subsection}/check_answers") |
|
|
|
|
expect(page).to have_content("Check the answers you gave for #{subsection.tr('_', ' ')}") |
|
|
|
|