From 63c46e30817a67f96b8f0f9bb12177bd6bc7a5b4 Mon Sep 17 00:00:00 2001 From: Paul Robert Lloyd Date: Wed, 19 Jan 2022 17:26:08 +0000 Subject: [PATCH] Remove link to complete all answers from check your answers page --- app/helpers/check_answers_helper.rb | 13 ++---------- app/views/form/check_answers.html.erb | 2 +- spec/features/form/check_answers_page_spec.rb | 20 ------------------- spec/helpers/check_answers_helper_spec.rb | 8 +++----- 4 files changed, 6 insertions(+), 37 deletions(-) diff --git a/app/helpers/check_answers_helper.rb b/app/helpers/check_answers_helper.rb index 98f8e5aa3..eca34fc95 100644 --- a/app/helpers/check_answers_helper.rb +++ b/app/helpers/check_answers_helper.rb @@ -5,10 +5,9 @@ module CheckAnswersHelper total = subsection.applicable_questions_count(case_log) answered = subsection.answered_questions_count(case_log) if total == answered - '

You answered all the questions

'.html_safe + '

You answered all the questions.

'.html_safe else - "

You answered #{answered} of #{total} questions

- #{create_next_missing_question_link(subsection, case_log)}".html_safe + "

You have answered #{answered} of #{total} questions.

".html_safe end end @@ -21,12 +20,4 @@ module CheckAnswersHelper "You didn’t answer this question".html_safe end end - -private - - def create_next_missing_question_link(subsection, case_log) - pages_to_fill_in = subsection.unanswered_questions(case_log).map(&:page) - url = "/logs/#{case_log.id}/#{pages_to_fill_in.first.id.to_s.dasherize}" - govuk_link_to("Answer the missing questions", url).html_safe - end end diff --git a/app/views/form/check_answers.html.erb b/app/views/form/check_answers.html.erb index cc3711b5b..42dd44c1b 100644 --- a/app/views/form/check_answers.html.erb +++ b/app/views/form/check_answers.html.erb @@ -15,7 +15,7 @@ <%= display_answered_questions_summary(subsection, @case_log) %> -
+
<% subsection.applicable_questions(@case_log).each do |question| %> <%= render partial: 'form/check_answers_table', locals: { question: question, case_log: @case_log } %> <% end %> diff --git a/spec/features/form/check_answers_page_spec.rb b/spec/features/form/check_answers_page_spec.rb index 577c1cdb8..6dff43960 100644 --- a/spec/features/form/check_answers_page_spec.rb +++ b/spec/features/form/check_answers_page_spec.rb @@ -89,26 +89,6 @@ RSpec.describe "Form Check Answers Page" do expect(page).to have_link("Change", href: "/logs/#{empty_case_log.id}/accessibility-requirements") end - it "should have a link pointing to the first question if no questions are answered" do - visit("/logs/#{empty_case_log.id}/#{subsection}/check-answers") - expect(page).to have_content("You answered 0 of 4 questions") - expect(page).to have_link("Answer the missing questions", href: "/logs/#{empty_case_log.id}/tenant-code") - end - - it "should have a link pointing to the next empty question if some questions are answered" do - fill_in_number_question(empty_case_log.id, "earnings", 18_000, "net-income") - - visit("/logs/#{empty_case_log.id}/income-and-benefits/check-answers") - expect(page).to have_content("You answered 1 of 4 questions") - expect(page).to have_link("Answer the missing questions", href: "/logs/#{empty_case_log.id}/net-income") - end - - it "should not display the missing answer questions link if all questions are answered" do - answer_all_questions_in_income_subsection(empty_case_log) - expect(page).to have_content("You answered all the questions") - assert_selector "a", text: "Answer the missing questions", count: 0 - end - it "does not display conditional questions that were not visited" do visit("/logs/#{id}/#{conditional_subsection}/check-answers") question_labels = ["Has the condition been met?"] diff --git a/spec/helpers/check_answers_helper_spec.rb b/spec/helpers/check_answers_helper_spec.rb index ee6612a49..a2cad9b6d 100644 --- a/spec/helpers/check_answers_helper_spec.rb +++ b/spec/helpers/check_answers_helper_spec.rb @@ -8,11 +8,9 @@ RSpec.describe CheckAnswersHelper do describe "display_answered_questions_summary" do context "given a section that hasn't been completed yet" do - it "returns a link to the next unanswered question" do + it "returns that you have unanswered questions" do expect(display_answered_questions_summary(subsection, case_log)) - .to match(/You answered 2 of 4 questions/) - expect(display_answered_questions_summary(subsection, case_log)) - .to match(/href/) + .to match(/You have answered 2 of 4 questions./) end end @@ -21,7 +19,7 @@ RSpec.describe CheckAnswersHelper do case_log.sex1 = "F" case_log.other_hhmemb = 0 expect(display_answered_questions_summary(subsection, case_log)) - .to match(/You answered all the questions/) + .to match(/You answered all the questions./) expect(display_answered_questions_summary(subsection, case_log)) .not_to match(/href/) end