From dac8b02cb6b8dd2a51d5863e398b62de4dc7925b Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 10 Jul 2023 10:23:35 +0100 Subject: [PATCH] Display duplicate check answers for logs --- .../_check_answers_summary_list.html.erb | 37 ------------------- .../duplicate_logs_controller_spec.rb | 11 ++++++ 2 files changed, 11 insertions(+), 37 deletions(-) delete mode 100644 app/views/duplicate_logs/_check_answers_summary_list.html.erb diff --git a/app/views/duplicate_logs/_check_answers_summary_list.html.erb b/app/views/duplicate_logs/_check_answers_summary_list.html.erb deleted file mode 100644 index 4d1bbd8a4..000000000 --- a/app/views/duplicate_logs/_check_answers_summary_list.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -<%= govuk_summary_list do |summary_list| %> - <% questions.each do |question| %> - <% summary_list.row do |row| %> - <% row.key { get_question_label(question) } %> - - <% row.value do %> - <%= simple_format( - get_answer_label(question, @log), - wrapper_tag: "span", - class: "govuk-!-margin-right-4", - ) %> - - <% extra_value = question.get_extra_check_answer_value(@log) %> - - <% if extra_value && question.answer_label(@log, current_user).present? %> - <%= simple_format( - extra_value, - wrapper_tag: "span", - class: "govuk-!-font-weight-regular app-!-colour-muted", - ) %> - <% end %> - - <% question.get_inferred_answers(@log).each do |inferred_answer| %> - <%= inferred_answer %> - <% end %> - <% end %> - - <% if @log.collection_period_open_for_editing? %> - <% row.action( - text: question.action_text(@log), - href: action_href(@log, question.page.id, referrer), - visually_hidden_text: question.check_answer_label.to_s.downcase, - ) %> - <% end %> - <% end %> - <% end %> -<% end %> diff --git a/spec/requests/duplicate_logs_controller_spec.rb b/spec/requests/duplicate_logs_controller_spec.rb index 3ba94c218..d27af4e5d 100644 --- a/spec/requests/duplicate_logs_controller_spec.rb +++ b/spec/requests/duplicate_logs_controller_spec.rb @@ -106,6 +106,17 @@ RSpec.describe DuplicateLogsController, type: :request do expect(page).to have_link("Keep this log and delete duplicates", count: 3) end end + + it "displays check your answers for each log with correct questions" do + expect(page).to have_content("Q5 - Tenancy start date", count: 3) + expect(page).to have_content("Q7 - Tenant code", count: 3) + expect(page).to have_content("Q12 - Postcode", count: 3) + expect(page).to have_content("Q32 - Lead tenant’s age", count: 3) + expect(page).to have_content("Q33 - Lead tenant’s gender identity", count: 3) + expect(page).to have_content("Q37 - Lead tenant’s working situation", count: 3) + expect(page).to have_content("Household rent and charges", count: 3) + expect(page).to have_link("Change", count: 21) + end end end end