git-secret/tests/test_usage.bats

46 lines
884 B
Plaintext
Raw Normal View History

2016-02-21 13:26:17 +00:00
#!/usr/bin/env bats
load _test_base
function setup {
set_state_initial
2016-02-21 13:26:17 +00:00
set_state_git
}
function teardown {
unset_current_state
}
@test "run 'usage'" {
run git secret usage
[ "$status" -eq 0 ]
}
@test "run 'usage' without '.git'" {
2016-02-21 13:26:17 +00:00
remove_git_repository
# It's ok for 'usage' to succeed when there's no .git directory, but it doesn't
2016-02-21 13:26:17 +00:00
run git secret usage
[ "$status" -eq 1 ]
}
2021-05-03 11:43:02 +00:00
#_SECRETS_DIR=${SECRETS_DIR:-".gitsecret"}
@test "run 'usage' with ignored '${_SECRETS_DIR}'" {
echo "${_SECRETS_DIR}" >> ".gitignore"
2021-05-03 11:43:02 +00:00
2018-09-07 19:48:19 +00:00
# below shows how to send 'diagnostic' messages to bats-core.
2021-05-03 11:43:02 +00:00
# echo "# clear-line-output" >&3
# echo "# SECRETS_DIR is ${_SECRETS_DIR}" >&3
# It's ok for 'usage' to succeed when the .gitsecret directory is ignored, but it doesn't
2016-02-21 13:26:17 +00:00
run git secret usage
2021-05-03 11:43:02 +00:00
# echo "# git secret usage -> status $status" >&3
2016-02-21 13:26:17 +00:00
[ "$status" -eq 1 ]
}