Browse Source

Merge pull request #575 from communitiesuk/1189-ambiguous-logs-link

pull/576/head
Paul Robert Lloyd 3 years ago committed by GitHub
parent
commit
ca12811eec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/views/case_logs/_log_list.html.erb
  2. 4
      spec/requests/case_logs_controller_spec.rb

4
app/views/case_logs/_log_list.html.erb

@ -24,7 +24,9 @@
<% case_logs.map do |log| %>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">
<%= govuk_link_to log.id, case_log_path(log) %>
<%= govuk_link_to case_log_path(log) do %>
<span class="govuk-visually-hidden">Log </span><%= log.id %>
<% end %>
</th>
<td class="govuk-table__cell app-!-font-tabular">
<%= log.tenant_code? ? log.tenant_code : "–" %>

4
spec/requests/case_logs_controller_spec.rb

@ -309,8 +309,8 @@ RSpec.describe CaseLogsController, type: :request do
end
it "only shows case logs for your organisation" do
expected_case_row_log = "<a class=\"govuk-link\" href=\"/logs/#{case_log.id}\">#{case_log.id}</a>"
unauthorized_case_row_log = "<a class=\"govuk-link\" href=\"/logs/#{unauthorized_case_log.id}\">#{unauthorized_case_log.id}</a>"
expected_case_row_log = "<span class=\"govuk-visually-hidden\">Log </span>#{case_log.id}"
unauthorized_case_row_log = "<span class=\"govuk-visually-hidden\">Log </span>#{unauthorized_case_log.id}"
expect(CGI.unescape_html(response.body)).to include(expected_case_row_log)
expect(CGI.unescape_html(response.body)).not_to include(unauthorized_case_row_log)
end

Loading…
Cancel
Save