Fix hooks tests on OS X by expanding BATS_TMPDIR

With `realpath` extension, hooks tests on OS X will output
`/private/tmp` instead of `/tmp` because the latter is an actual symlink
to the former.

Avoid this mistmach in output assertions by expanding BATS_TMPDIR if
`realpath` extension is compiled.
This commit is contained in:
Mislav Marohnić 2014-01-04 16:32:54 +01:00
parent 16c7eb4135
commit 284588f9b4

View file

@ -1,7 +1,11 @@
unset RBENV_VERSION
unset RBENV_DIR
if enable -f "${BATS_TEST_DIRNAME}"/../libexec/rbenv-realpath.dylib realpath 2>/dev/null; then
RBENV_TEST_DIR="$(realpath "$BATS_TMPDIR")/rbenv"
else
RBENV_TEST_DIR="${BATS_TMPDIR}/rbenv"
fi
# guard against executing this block twice due to bats internals
if [ "$RBENV_ROOT" != "${RBENV_TEST_DIR}/root" ]; then