Skip to content

armgit / maybe

Public Imported from GitHub
0

The personal finance app for everyone

fix(authentication): Fix issues when users try to logout (#603)

Pablo Porto00a42be5c0bb
diff --git a/app/controllers/concerns/authentication.rb b/app/controllers/concerns/authentication.rb
index 64d0a8c0..01a4f297 100644
--- a/app/controllers/concerns/authentication.rb
+++ b/app/controllers/concerns/authentication.rb
@@ -3,7 +3,7 @@ module Authentication
included do
before_action :authenticate_user!
- after_action :set_last_login_at
+ after_action :set_last_login_at, if: -> { Current.user }
end
class_methods do
diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb
index 42eb8460..431da1d5 100644
--- a/test/application_system_test_case.rb
+++ b/test/application_system_test_case.rb
@@ -12,6 +12,9 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
fill_in "Password", with: "password"
click_button "Log in"
end
- assert_text "Dashboard"
+ assert_text "Dashboard", wait: 5
+ find('[data-controller="menu"]').click
+ click_button "Logout"
+ assert_text "Sign in to your account"
end
end