1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-16 23:33:45 -05:00

tests galore

This commit is contained in:
Mislav Marohnić
2013-03-07 15:05:49 -05:00
parent 1fe59e41ea
commit bb6bccb782
13 changed files with 336 additions and 23 deletions

47
test/rbenv.bats Normal file
View 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'"
}