Browse Source

Display duplicate check answers for logs

pull/1752/head
Kat 3 years ago
parent
commit
dac8b02cb6
  1. 37
      app/views/duplicate_logs/_check_answers_summary_list.html.erb
  2. 11
      spec/requests/duplicate_logs_controller_spec.rb

37
app/views/duplicate_logs/_check_answers_summary_list.html.erb

@ -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| %>
<span class="govuk-!-font-weight-regular app-!-colour-muted"><%= inferred_answer %></span>
<% 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 %>

11
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) expect(page).to have_link("Keep this log and delete duplicates", count: 3)
end end
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 end
end end

Loading…
Cancel
Save