Fix crash in join code redemption race condition

This commit is contained in:
Stanko K.R.
2025-12-03 13:27:15 +01:00
parent def487208c
commit 6e9381abb8
6 changed files with 42 additions and 25 deletions
@@ -43,7 +43,7 @@ class JoinCodesControllerTest < ActionDispatch::IntegrationTest
identity = identities(:jz)
sign_in_as :jz
assert identity.member_of?(@account), "JZ should be a member of 37s for this test"
assert identity.users.exists?(account: @account), "JZ should be a member of 37s for this test"
assert identity.users.find_by!(account: @account).setup?, "JZ's user should be setup for this test"
assert_no_difference -> { Identity.count } do
@@ -59,7 +59,7 @@ class JoinCodesControllerTest < ActionDispatch::IntegrationTest
identity = identities(:mike)
sign_in_as :mike
assert_not identity.member_of?(@account), "Mike should not be a member of 37s for this test"
assert_not identity.users.exists?(account: @account), "Mike should not be a member of 37s for this test"
assert_no_difference -> { Identity.count } do
assert_difference -> { User.count }, 1 do