Skip to content

Commit

Permalink
test: prefer ex unit tmp_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
grzuy committed Feb 22, 2024
1 parent fcd2ba4 commit 20c1788
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions test/blend_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,10 @@ defmodule BlendTest do
use ExUnit.Case
doctest Blend

@tmp_path Path.expand("../tmp", __DIR__)

setup do
File.mkdir_p!(@tmp_path)
on_exit(fn -> File.rm_rf(@tmp_path) end)
:ok
end

test "init/0 generates blend file" do
@tag :tmp_dir
test "init/0 generates blend file", %{tmp_dir: tmp_dir} do
File.cd!(
@tmp_path,
tmp_dir,
fn ->
refute File.exists?("blend.exs")
Mix.Task.run("blend.init")
Expand All @@ -21,9 +14,10 @@ defmodule BlendTest do
)
end

test "blend.get task" do
@tag :tmp_dir
test "blend.get task", %{tmp_dir: tmp_dir} do
File.cd!(
@tmp_path,
tmp_dir,
fn ->
File.write(
"blend.exs",
Expand Down

0 comments on commit 20c1788

Please sign in to comment.