Skip to content

Commit 648b49d

Browse files
committed
Use GitPath to expect resolved path
See comment from the code, TLDR macOS /var is a symlink to /priv/var and tests fail because of that
1 parent 953ae0a commit 648b49d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/mix/tasks/git_hooks/install_test.exs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,14 @@ defmodule Mix.Tasks.InstallTest do
7575

7676
hooks_file = Install.run(["--dry-run", "--quiet"])
7777

78+
# Use the resolved git path to fix symlinks on SO (such as macOS)
79+
# This is not ideal, but using `Path.expand(project_path)` instead
80+
# is not working because in macOS /var is a symlink to /private/var
81+
resolved_project_path = GitHooks.Git.GitPath.resolve_app_path()
82+
7883
assert hooks_file == [
79-
pre_commit: expect_hook_template("pre_commit", project_path),
80-
pre_push: expect_hook_template("pre_push", project_path)
84+
pre_commit: expect_hook_template("pre_commit", resolved_project_path),
85+
pre_push: expect_hook_template("pre_push", resolved_project_path)
8186
]
8287
end)
8388
end

0 commit comments

Comments
 (0)