mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-07 20:31:01 -05:00
1e1c9cb0dc
On other systems, we expected to find system Ruby in `/usr/bin`, but in OpenBSD 5.4 it will be found in `/usr/local/bin`. This replaces the limited USRBIN_ALT hack with a more generic `path_without` function that will ensure that the given executable is not present in the resulting PATH even if it's found in multiple system paths.
30 lines
784 B
Bash
30 lines
784 B
Bash
#!/usr/bin/env bats
|
|
|
|
load test_helper
|
|
|
|
@test "prefix" {
|
|
mkdir -p "${RBENV_TEST_DIR}/myproject"
|
|
cd "${RBENV_TEST_DIR}/myproject"
|
|
echo "1.2.3" > .ruby-version
|
|
mkdir -p "${RBENV_ROOT}/versions/1.2.3"
|
|
run rbenv-prefix
|
|
assert_success "${RBENV_ROOT}/versions/1.2.3"
|
|
}
|
|
|
|
@test "prefix for invalid version" {
|
|
RBENV_VERSION="1.2.3" run rbenv-prefix
|
|
assert_failure "rbenv: version \`1.2.3' not installed"
|
|
}
|
|
|
|
@test "prefix for system" {
|
|
mkdir -p "${RBENV_TEST_DIR}/bin"
|
|
touch "${RBENV_TEST_DIR}/bin/ruby"
|
|
chmod +x "${RBENV_TEST_DIR}/bin/ruby"
|
|
RBENV_VERSION="system" run rbenv-prefix
|
|
assert_success "$RBENV_TEST_DIR"
|
|
}
|
|
|
|
@test "prefix for invalid system" {
|
|
PATH="$(path_without ruby)" run rbenv-prefix system
|
|
assert_failure "rbenv: system version not found in PATH"
|
|
}
|