From 5beae9a79381d3652abbb7a028cfccb4f00a7567 Mon Sep 17 00:00:00 2001 From: Pablo Brasero Date: Thu, 29 Oct 2026 17:28:20 +0000 Subject: [PATCH] Test realistic scenarios. Plus weird ones are ok too This was testing the behaviour of logging out, but without being logged in first. For our current code this might not matter, but it does matter with other solutions such as Devise. We should test the different interactions more carefully. --- test/controllers/sessions_controller_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/controllers/sessions_controller_test.rb b/test/controllers/sessions_controller_test.rb index d52d75895..836b0a715 100644 --- a/test/controllers/sessions_controller_test.rb +++ b/test/controllers/sessions_controller_test.rb @@ -106,11 +106,23 @@ class SessionsControllerTest < ActionDispatch::IntegrationTest end def test_logout_without_referer + # From logged out + post logout_path + assert_redirected_to root_path + + # From logged in + session_for(create(:user)) post logout_path assert_redirected_to root_path end def test_logout_with_referer + # From logged out + post logout_path, :params => { :referer => "/test" } + assert_redirected_to "/test" + + # From logged in + session_for(create(:user)) post logout_path, :params => { :referer => "/test" } assert_redirected_to "/test" end -- 2.47.3