From 3a265c1af9daebd09aa36a4ce27c3f766a33f151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Sat, 10 Oct 2015 18:30:44 +0200 Subject: [PATCH] Unset XDG_CONFIG_HOME and related variables during tests If set by the user's environment, `git config --global` writes will go to that destination instead of temporary $HOME. We definitely don't want that. Fixes #742 --- test/test_helper.bash | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test_helper.bash b/test/test_helper.bash index 461bb085..5fac8bb3 100644 --- a/test/test_helper.bash +++ b/test/test_helper.bash @@ -22,6 +22,9 @@ if [ "$RBENV_ROOT" != "${RBENV_TEST_DIR}/root" ]; then PATH="${BATS_TEST_DIRNAME}/libexec:$PATH" PATH="${RBENV_ROOT}/shims:$PATH" export PATH + + for xdg_var in `env 2>/dev/null | grep ^XDG_ | cut -d= -f1`; do unset "$xdg_var"; done + unset xdg_var fi teardown() {