Skip to content

Commit 3324333

Browse files
committed
test: refactored to avoid double importing ExCase/CaseTemplate
1 parent 5a6dcd7 commit 3324333

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

test/support/image_test_case.ex

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
defmodule ImageTestCase do
22
@moduledoc false
3-
use ExUnit.CaseTemplate, async: true
3+
4+
defmacro __using__(opts) do
5+
quote do
6+
use ExUnit.Case, async: async?
7+
8+
import ImageTestCase
9+
10+
async? = Keyword.get(unquote(opts), :async, true)
11+
end
12+
end
413

514
@doc "Reads an image giving a relative path to test/fixtures/images"
615
def read_image(rel_path) do
716
abs_path = Path.expand(Path.join("test/fixtures/images", rel_path), File.cwd!())
817
File.read!(abs_path)
918
end
10-
11-
using do
12-
quote do
13-
def read_image(rel_path), do: ImageTestCase.read_image(rel_path)
14-
end
15-
end
1619
end

0 commit comments

Comments
 (0)