-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify work with a repository for tests
`addons-git.bash` is renamed to `addons-repo.bash`. Also, all functions inside are using unified naming convention - `repo[...]`. This should simplify reading of tests and their writting. Also, where possible, the updated functions were applied for current BATS tests.
- Loading branch information
Showing
11 changed files
with
85 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
GIT_REPO_DIR="/tmp/elegant-git-repo" | ||
FILE_TO_MODIFY=file | ||
|
||
repo-new() { | ||
if [[ -n "${GIT_REPO_DIR}" ]]; then | ||
testtee mkdir -p ${GIT_REPO_DIR} | ||
testtee cd ${GIT_REPO_DIR} | ||
testtee git init | ||
testtee git config --local user.email "\"[email protected]\"" | ||
testtee git config --local user.name "\"Elegant Git\"" | ||
testtee git config --local core.editor "\"edi\"" | ||
testtee touch ${FILE_TO_MODIFY} | ||
testtee git add . | ||
testtee git commit -m "\"Add ${FILE_TO_MODIFY}\"" | ||
else | ||
exit 1 | ||
fi | ||
} | ||
|
||
repo-non-staged-change(){ | ||
# modifies committed file | ||
# usage: repo-non-staged-change <text>... | ||
testtee "echo -e \"${@}\" >> ${FILE_TO_MODIFY}" | ||
} | ||
|
||
repo-staged-change(){ | ||
# modifies committed file and stages changes | ||
# usage: repo-staged-change <text>... | ||
repo-non-staged-change "${@}" | ||
testtee git add ${FILE_TO_MODIFY} | ||
} | ||
|
||
repo() { | ||
# execute given arguments on real git repo | ||
# usage: repo <command and arguments> | ||
testtee cd ${GIT_REPO_DIR} | ||
testtee "${@}" | ||
} | ||
|
||
repo-clean() { | ||
if [[ -d "${GIT_REPO_DIR}" ]]; then | ||
rm -rf "${GIT_REPO_DIR}" | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters