File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
defmodule GitHooks.TestSupport.GitProjectCase do
2
2
@ moduledoc """
3
3
This module provides a setup that creates a tmp git project
4
- for the testing context
4
+ for the testing context.
5
5
"""
6
6
7
7
use ExUnit.CaseTemplate
8
8
9
9
using do
10
10
quote do
11
11
setup do
12
- # Create a temporary directory
13
12
tmp_dir = Path . join ( System . tmp_dir! ( ) , "git_hooks_test_#{ :os . system_time ( :millisecond ) } " )
14
13
File . mkdir_p! ( tmp_dir )
15
14
16
- # Initialize a git repository in the temporary directory
17
15
System . cmd ( "git" , [ "init" ] , cd: tmp_dir )
18
16
19
- # Set the :project_path in Application environment
20
17
Application . put_env ( :git_hooks , :project_path , tmp_dir )
21
18
22
- # Return the context with the tmp_dir
19
+ on_exit ( fn ->
20
+ File . rm_rf ( tmp_dir )
21
+ end )
22
+
23
23
{ :ok , tmp_dir: tmp_dir }
24
24
end
25
25
end
You can’t perform that action at this time.
0 commit comments