Skip to content

Commit a8759d3

Browse files
committed
Add test for file task type
1 parent c54fd4b commit a8759d3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

priv/test_script

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
#!/bin/bash
22

3+
echo "Test script"
4+
35
echo "$@"

test/mix/tasks/git_hooks/run_test.exs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ defmodule Mix.Tasks.RunTest do
1010

1111
alias Mix.Tasks.GitHooks.Run
1212

13+
describe "Given task" do
14+
test "when it is a file then the file it's executed" do
15+
put_git_hook_config(:pre_commit, tasks: [{:file, "priv/test_script"}], verbose: true)
16+
17+
assert capture_io(fn ->
18+
assert Run.run(["pre-commit"]) == :ok
19+
end) =~ "Test script"
20+
end
21+
end
22+
1323
describe "Given args for the mix git hook task" do
1424
test "when no git hook type is provided then the process exits with 1" do
1525
capture_io(fn ->

0 commit comments

Comments
 (0)