pyenv/test/rehash.bats
Mislav Marohnić bb6bccb782 tests galore
2013-03-07 15:07:32 -05:00

27 lines
649 B
Bash
Executable file

#!/usr/bin/env bats
load test_helper
@test "empty rehash" {
assert [ ! -d "${RBENV_ROOT}/shims" ]
run rbenv-rehash
assert_success
assert [ -d "${RBENV_ROOT}/shims" ]
rmdir "${RBENV_ROOT}/shims"
}
@test "non-writable shims directory" {
mkdir -p "${RBENV_ROOT}/shims"
chmod -w "${RBENV_ROOT}/shims"
run rbenv-rehash
assert_failure
assert_output "rbenv: cannot rehash: ${RBENV_ROOT}/shims isn't writable"
}
@test "rehash in progress" {
mkdir -p "${RBENV_ROOT}/shims"
touch "${RBENV_ROOT}/shims/.rbenv-shim"
run rbenv-rehash
assert_failure
assert_output "rbenv: cannot rehash: ${RBENV_ROOT}/shims/.rbenv-shim exists"
}