From e70732a47fbded08018ddf60ba78e2b45fdd2504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 22 Feb 2025 23:22:21 +0100 Subject: [PATCH] Don't create records after starting the browser in user test I accidentally made this mistake while trying to avoid the exact same issue back in commit 73992b2c8. Accessing the database in a test after starting the process running the browser has caused database corruption in our CI multiple times. --- spec/system/management/users_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/system/management/users_spec.rb b/spec/system/management/users_spec.rb index 3b183b0fa..b35cec7c8 100644 --- a/spec/system/management/users_spec.rb +++ b/spec/system/management/users_spec.rb @@ -72,6 +72,7 @@ describe "Users" do scenario "Delete a level 2 user account from document verification page" do level_2_user = create(:user, :level_two, document_number: "12345678Z") manager = create(:manager) + administrator = create(:administrator) login_as_manager(manager) visit management_document_verifications_path @@ -92,7 +93,7 @@ describe "Users" do expect(page).to have_content "no user account associated to it" logout - login_as(create(:administrator).user) + login_as(administrator.user) visit admin_users_path(filter: "erased")