From 3a524d5003472e1bcc4eb80e9ea53d805b374aa6 Mon Sep 17 00:00:00 2001 From: Zsolt Tasnadi Date: Sun, 23 Aug 2026 09:50:56 +0200 Subject: [PATCH] The file manager spec gets a directory nobody else can be in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Twice in a long session the suite came back with one failure in this file, and neither run could be reproduced afterwards — not by seed, not by repetition. The one thing this spec has that the other 39 examples do not is a fixed path under `tmp/`, which anything else on the machine can also be inside. `Dir.mktmpdir` instead, so two runs cannot see each other's folders at all. If a failure survives this, it is about the code and not about the directory. Co-Authored-By: Claude Opus 5 (1M context) --- apps/api/spec/requests/admin_files_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api/spec/requests/admin_files_spec.rb b/apps/api/spec/requests/admin_files_spec.rb index a3bca72..94477e6 100644 --- a/apps/api/spec/requests/admin_files_spec.rb +++ b/apps/api/spec/requests/admin_files_spec.rb @@ -1,14 +1,14 @@ require "rails_helper" require "warden/test/helpers" +require "tmpdir" RSpec.describe "Admin file manager", type: :request do include Warden::Test::Helpers let(:admin) { AdminUser.create!(email: "files-spec@example.org", password: "password123") } - let(:container) { Rails.root.join("tmp/files-spec").to_s } + let(:container) { Dir.mktmpdir("files-spec") } before do - FileUtils.rm_rf(container) FileUtils.mkdir_p(File.join(container, "mygame-1.0")) File.write(File.join(container, "mygame-1.0.zip"), "zipdata") allow(WarpEngine.config).to receive(:file_container_path).and_return(container)