mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-07 20:31:01 -05:00
47 lines
984 B
Bash
47 lines
984 B
Bash
#!/usr/bin/env bats
|
|
|
|
load test_helper
|
|
|
|
@test "blank invocation" {
|
|
run rbenv
|
|
assert_success
|
|
assert [ "${lines[0]}" = "rbenv 0.4.0" ]
|
|
}
|
|
|
|
@test "invalid command" {
|
|
run rbenv does-not-exist
|
|
assert_failure
|
|
assert_output "rbenv: no such command \`does-not-exist'"
|
|
}
|
|
|
|
@test "default RBENV_ROOT" {
|
|
RBENV_ROOT="" HOME=/home/mislav run rbenv root
|
|
assert_success
|
|
assert_output "/home/mislav/.rbenv"
|
|
}
|
|
|
|
@test "inherited RBENV_ROOT" {
|
|
RBENV_ROOT=/opt/rbenv run rbenv root
|
|
assert_success
|
|
assert_output "/opt/rbenv"
|
|
}
|
|
|
|
@test "default RBENV_DIR" {
|
|
run rbenv echo RBENV_DIR
|
|
assert_output "$(pwd)"
|
|
}
|
|
|
|
@test "inherited RBENV_DIR" {
|
|
dir="${BATS_TMPDIR}/myproject"
|
|
mkdir -p "$dir"
|
|
RBENV_DIR="$dir" run rbenv echo RBENV_DIR
|
|
assert_output "$dir"
|
|
}
|
|
|
|
@test "invalid RBENV_DIR" {
|
|
dir="${BATS_TMPDIR}/does-not-exist"
|
|
assert [ ! -d "$dir" ]
|
|
RBENV_DIR="$dir" run rbenv echo RBENV_DIR
|
|
assert_failure
|
|
assert_output "rbenv: cannot change working directory to \`$dir'"
|
|
}
|