From 284588f9b4769297c8affa5419ec2e6f59047c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Sat, 4 Jan 2014 16:32:54 +0100 Subject: [PATCH] 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. --- test/test_helper.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/test_helper.bash b/test/test_helper.bash index 53ae8e64..1f772bea 100644 --- a/test/test_helper.bash +++ b/test/test_helper.bash @@ -1,7 +1,11 @@ unset RBENV_VERSION unset RBENV_DIR -RBENV_TEST_DIR="${BATS_TMPDIR}/rbenv" +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