Skip to content

Commit d38a98f

Browse files
Pedro Piñera Buendíaclaude
authored andcommitted
Use ExUnit tmp_dir instead of manual temp directory management
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b1c81ce commit d38a98f

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

test/terrarium/providers/local_test.exs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,16 @@ defmodule Terrarium.Providers.LocalTest do
1515
Local.destroy(sandbox)
1616
end
1717

18-
test "creates a sandbox with a custom cwd" do
19-
dir = Path.join(System.tmp_dir!(), "terrarium-test-#{System.unique_integer([:positive])}")
20-
File.mkdir_p!(dir)
18+
@tag :tmp_dir
19+
test "creates a sandbox with a custom cwd", %{tmp_dir: tmp_dir} do
20+
{:ok, sandbox} = Local.create(cwd: tmp_dir)
2121

22-
{:ok, sandbox} = Local.create(cwd: dir)
23-
24-
assert sandbox.state["cwd"] == dir
22+
assert sandbox.state["cwd"] == tmp_dir
2523
assert sandbox.state["temp"] == false
2624

2725
Local.destroy(sandbox)
2826
# Custom cwd should not be deleted
29-
assert File.dir?(dir)
30-
File.rm_rf!(dir)
27+
assert File.dir?(tmp_dir)
3128
end
3229
end
3330

0 commit comments

Comments
 (0)