Skip to content

Commit

Permalink
Ensure logout uses the correct HTTP method
Browse files Browse the repository at this point in the history
  • Loading branch information
elia committed Sep 25, 2023
1 parent 79d0058 commit da699fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<% end %>
</li>
<li class="h-8 flex items-center hover:bg-gray-25 rounded">
<%= link_to @logout_path, method: @logout_method, class: 'flex gap-2 items-center px-2' do %>
<%= button_to @logout_path, method: @logout_method, class: 'flex gap-2 items-center px-2' do %>
<%= icon_tag("logout-box-line", class: "w-5 h-5 fill-current shrink") %>
<span><%= t('.logout') %></span>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@

# Links are hidden within a <details> element
expect(page).to have_link("Account", href: "/admin/account", visible: :any)
expect(page).to have_link("Logout", href: "/admin/logout", visible: :any)
expect(page.find_link("Logout", visible: :any)["data-method"]).to eq("delete")
within('form[action="/admin/logout"]') do
expect(page).to have_button("Logout", visible: :any)
expect(page).to have_css('input[type="hidden"][name="_method"][value="delete"]')
end
end
end
end

0 comments on commit da699fd

Please sign in to comment.