mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-16 23:33:45 -05:00
tests galore
This commit is contained in:
47
test/rbenv.bats
Normal file
47
test/rbenv.bats
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/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'"
|
||||
}
|
||||
Reference in New Issue
Block a user