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