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..4055cda6c 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}, method: :delete }) end end %> diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index dd8eacfce..835321c6a 100644 --- a/spec/features/user_spec.rb +++ b/spec/features/user_spec.rb @@ -30,6 +30,26 @@ RSpec.describe "User Features" do click_button("Sign in") expect(page).to have_current_path("/logs") end + + it " can log out again", js: true 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 + + it " can log out again with js disabled" 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