pyenv/test/rehash.bats

28 lines
649 B
Text
Raw Normal View History

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