Skip to content

Commit

Permalink
Add a test to confirm the prefix doesn't work fine with /bin/ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
yyuu committed Aug 1, 2016
1 parent 9fdce5d commit 2485257
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions test/prefix.bats
Expand Up @@ -24,6 +24,15 @@ load test_helper
assert_success "$RBENV_TEST_DIR"
}

@test "prefix for system in /" {
mkdir -p "${RBENV_TEST_DIR}/bin"
touch "${RBENV_TEST_DIR}/bin/rbenv-which"
echo "echo /bin/ruby" >"${RBENV_TEST_DIR}/bin/rbenv-which"
chmod +x "${RBENV_TEST_DIR}/bin/rbenv-which"
RBENV_VERSION="system" run rbenv-prefix
assert_success "/"
}

@test "prefix for invalid system" {
PATH="$(path_without ruby)" run rbenv-prefix system
assert_failure "rbenv: system version not found in PATH"
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.bash
Expand Up @@ -20,10 +20,10 @@ if [ -z "$RBENV_TEST_DIR" ]; then
export RBENV_HOOK_PATH="${RBENV_ROOT}/rbenv.d"

PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
PATH="${RBENV_TEST_DIR}/bin:$PATH"
PATH="${BATS_TEST_DIRNAME}/../libexec:$PATH"
PATH="${BATS_TEST_DIRNAME}/libexec:$PATH"
PATH="${RBENV_ROOT}/shims:$PATH"
PATH="${RBENV_TEST_DIR}/bin:$PATH"
export PATH

for xdg_var in `env 2>/dev/null | grep ^XDG_ | cut -d= -f1`; do unset "$xdg_var"; done
Expand Down

0 comments on commit 2485257

Please sign in to comment.