Tie access token directly to session

We need to present them differently in the session list and prevent them
from being deleted
This commit is contained in:
David Heinemeier Hansson
2025-12-01 18:07:17 +01:00
committed by Stanko K.R.
parent b53c0a5385
commit db29562c4c
8 changed files with 20 additions and 17 deletions
+3 -8
View File
@@ -1,13 +1,8 @@
require "test_helper"
class Identity::AccessTokenTest < ActiveSupport::TestCase
test "only one session at the time" do
assert_changes -> { Session.count }, +1 do
identity_access_tokens(:jasons_api_token).session
end
assert_no_changes -> { Session.count } do
identity_access_tokens(:jasons_api_token).session
end
test "new access token comes with a session" do
access_token = identities(:david).access_tokens.create!
assert_equal "Access Token", identities(:david).sessions.last.user_agent
end
end