Skip to content

Commit

Permalink
replace stubbed git hooks dir on tests to getGitHooksDir
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Abroskin committed Nov 16, 2019
1 parent 074352a commit afa40d6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go

go:
- 1.11.x
- 1.13.x

notifications:
email: false
Expand Down
4 changes: 0 additions & 4 deletions cmd/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ import (
"github.com/spf13/cobra"
)

const (
gitHooksDir string = ".git/hooks"
)

var createDirsFlag bool

var addCmd = &cobra.Command{
Expand Down
8 changes: 4 additions & 4 deletions cmd/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestInstallCmdExecutor(t *testing.T) {
"prepare-commit-msg",
}

files, err := afero.ReadDir(fs, filepath.Join(getRootPath(), ".git/hooks"))
files, err := afero.ReadDir(fs,getGitHooksDir())
assert.NoError(t, err)

actualFiles := []string{}
Expand All @@ -58,7 +58,7 @@ func TestAddCmdExecutor(t *testing.T) {
"pre-commit",
}

files, _ := afero.ReadDir(fs, filepath.Join(getRootPath(), ".git/hooks"))
files, _ := afero.ReadDir(fs, getGitHooksDir())
actualFiles := []string{}
for _, f := range files {
actualFiles = append(actualFiles, f.Name())
Expand All @@ -80,7 +80,7 @@ func TestAddCmdExecutor(t *testing.T) {
"pre-push.old",
}

files, _ = afero.ReadDir(fs, filepath.Join(getRootPath(), ".git/hooks"))
files, _ = afero.ReadDir(fs, getGitHooksDir())
actualFiles = []string{}
for _, f := range files {
actualFiles = append(actualFiles, f.Name())
Expand All @@ -97,7 +97,7 @@ func presetConfig(fs afero.Fs) {
fs.Mkdir(filepath.Join(getRootPath(), ".lefthook/commit-msg"), defaultFilePermission)
fs.Mkdir(filepath.Join(getRootPath(), ".lefthook/pre-commit"), defaultFilePermission)

fs.Mkdir(filepath.Join(getRootPath(), ".git/hooks"), defaultFilePermission)
fs.Mkdir(getGitHooksDir(), defaultFilePermission)
}

func presetExecutable(hookName string, hookGroup string, exitCode string, fs afero.Fs) {
Expand Down

0 comments on commit afa40d6

Please sign in to comment.