|
|
@ -71,10 +71,10 @@ RSpec.describe "Form Check Answers Page" do |
|
|
|
# Regex explanation: match the string "Answer" but not if it's follow by "the missing questions" |
|
|
|
# Regex explanation: match the string "Answer" but not if it's follow by "the missing questions" |
|
|
|
# This way only the links in the table will get picked up |
|
|
|
# This way only the links in the table will get picked up |
|
|
|
it "has an answer link for questions missing an answer" do |
|
|
|
it "has an answer link for questions missing an answer" do |
|
|
|
visit("/logs/#{empty_case_log.id}/#{subsection}/check-answers") |
|
|
|
visit("/logs/#{empty_case_log.id}/#{subsection}/check-answers?referrer=check_answers") |
|
|
|
assert_selector "a", text: /Answer (?!the missing questions)/, count: 5 |
|
|
|
assert_selector "a", text: /Answer (?!the missing questions)/, count: 5 |
|
|
|
assert_selector "a", text: "Change", count: 0 |
|
|
|
assert_selector "a", text: "Change", count: 0 |
|
|
|
expect(page).to have_link("Answer", href: "/logs/#{empty_case_log.id}/person-1-age") |
|
|
|
expect(page).to have_link("Answer", href: "/logs/#{empty_case_log.id}/person-1-age?referrer=check_answers") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "has a change link for answered questions" do |
|
|
|
it "has a change link for answered questions" do |
|
|
@ -82,7 +82,7 @@ RSpec.describe "Form Check Answers Page" do |
|
|
|
visit("/logs/#{empty_case_log.id}/#{subsection}/check-answers") |
|
|
|
visit("/logs/#{empty_case_log.id}/#{subsection}/check-answers") |
|
|
|
assert_selector "a", text: /Answer (?!the missing questions)/, count: 4 |
|
|
|
assert_selector "a", text: /Answer (?!the missing questions)/, count: 4 |
|
|
|
assert_selector "a", text: "Change", count: 1 |
|
|
|
assert_selector "a", text: "Change", count: 1 |
|
|
|
expect(page).to have_link("Change", href: "/logs/#{empty_case_log.id}/person-1-age") |
|
|
|
expect(page).to have_link("Change", href: "/logs/#{empty_case_log.id}/person-1-age?referrer=check_answers") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "updates the change/answer link when answers get updated" do |
|
|
|
it "updates the change/answer link when answers get updated" do |
|
|
@ -95,7 +95,7 @@ RSpec.describe "Form Check Answers Page" do |
|
|
|
visit("/logs/#{empty_case_log.id}/household-needs/check-answers") |
|
|
|
visit("/logs/#{empty_case_log.id}/household-needs/check-answers") |
|
|
|
assert_selector "a", text: /Answer (?!the missing questions)/, count: 3 |
|
|
|
assert_selector "a", text: /Answer (?!the missing questions)/, count: 3 |
|
|
|
assert_selector "a", text: "Change", count: 2 |
|
|
|
assert_selector "a", text: "Change", count: 2 |
|
|
|
expect(page).to have_link("Change", href: "/logs/#{empty_case_log.id}/accessibility-requirements") |
|
|
|
expect(page).to have_link("Change", href: "/logs/#{empty_case_log.id}/accessibility-requirements?referrer=check_answers") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "does not display conditional questions that were not visited" do |
|
|
|
it "does not display conditional questions that were not visited" do |
|
|
@ -127,6 +127,18 @@ RSpec.describe "Form Check Answers Page" do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when the user changes their answer" do |
|
|
|
|
|
|
|
it "routes back to check answers" do |
|
|
|
|
|
|
|
visit("/logs/#{empty_case_log.id}/accessibility-requirements") |
|
|
|
|
|
|
|
check("case-log-accessibility-requirements-housingneeds-c-field") |
|
|
|
|
|
|
|
click_button("Save and continue") |
|
|
|
|
|
|
|
visit("/logs/#{empty_case_log.id}/household-needs/check-answers") |
|
|
|
|
|
|
|
first("a", text: /Change/).click |
|
|
|
|
|
|
|
click_button("Save and continue") |
|
|
|
|
|
|
|
expect(page).to have_current_path("/logs/#{empty_case_log.id}/household-needs/check-answers") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when the user wants to bypass the tasklist page from check answers" do |
|
|
|
context "when the user wants to bypass the tasklist page from check answers" do |
|
|
|
let(:section_completed_case_log) do |
|
|
|
let(:section_completed_case_log) do |
|
|
|
FactoryBot.create( |
|
|
|
FactoryBot.create( |
|
|
|