From c92bb77333a9794b6cf548fd6128f0c3c506177e Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Tue, 25 Jan 2022 18:21:39 +0000 Subject: [PATCH] Fix sign out link (UJS -> Turbo) --- Gemfile.lock | 2 +- app/views/layouts/application.html.erb | 2 +- spec/features/user_spec.rb | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 346f575c9..46cfa6279 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,7 +8,7 @@ GIT GIT remote: https://github.com/baarkerlounger/devise.git - revision: 223969286e51b02e78309b7dad908d223d6ba7f5 + revision: ac956cc2a58daa57e071202967a212a1dac08053 branch: dluhc-fixes specs: devise (4.8.1) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 660b80bb8..b958b6584 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -46,7 +46,7 @@ component.navigation_item(text: 'Your logs', href: case_logs_path) component.navigation_item(text: 'Your organisation', href: "/organisations/#{current_user.organisation.id}") component.navigation_item(text: 'Your account', href: user_path(current_user)) - component.navigation_item(text: 'Sign out', href: destroy_user_session_path, options: {:method => :delete}) + component.navigation_item(text: 'Sign out', href: destroy_user_session_path, options: { data: {turbo_method: :delete} }) end end %> diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index dd8eacfce..db7d0e342 100644 --- a/spec/features/user_spec.rb +++ b/spec/features/user_spec.rb @@ -30,6 +30,16 @@ RSpec.describe "User Features" do click_button("Sign in") expect(page).to have_current_path("/logs") end + + it " can log out again" do + visit("/logs") + fill_in("user[email]", with: user.email) + fill_in("user[password]", with: "pAssword1") + click_button("Sign in") + click_link("Sign out") + expect(page).to have_current_path("/") + expect(page).to have_content("Start now") + end end context "A user who has forgotten their password" do