#!/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" }