Simplify version-name, version-origin hook tests

No need for helper function that's gonna be used just once.
This commit is contained in:
Mislav Marohnić 2015-12-23 17:32:21 +01:00
parent 4fde4ecbaf
commit 6e30032278
2 changed files with 10 additions and 22 deletions

View file

@ -2,13 +2,6 @@
load test_helper
export RBENV_HOOK_PATH="${RBENV_ROOT}/rbenv.d"
create_hook() {
mkdir -p "${RBENV_ROOT}/rbenv.d/version-name"
cat > "${RBENV_ROOT}/rbenv.d/version-name/$1" <<<"$2"
}
create_version() {
mkdir -p "${RBENV_ROOT}/versions/$1"
}
@ -33,11 +26,12 @@ setup() {
create_version "1.8.7"
create_version "1.9.3"
RBENV_VERSION=1.8.7 run rbenv-version-name
assert_success "1.8.7"
mkdir -p "${RBENV_ROOT}/rbenv.d/version-name"
cat > "${RBENV_ROOT}/rbenv.d/version-name/test.bash" <<HOOK
RBENV_VERSION=1.9.3
HOOK
create_hook test.bash "RBENV_VERSION=1.9.3"
RBENV_VERSION=1.8.7 run rbenv-version-name
RBENV_VERSION=1.8.7 RBENV_HOOK_PATH="${RBENV_ROOT}/rbenv.d" run rbenv-version-name
assert_success "1.9.3"
}

View file

@ -2,13 +2,6 @@
load test_helper
export RBENV_HOOK_PATH="${RBENV_ROOT}/rbenv.d"
create_hook() {
mkdir -p "${RBENV_ROOT}/rbenv.d/version-origin"
cat > "${RBENV_ROOT}/rbenv.d/version-origin/$1" <<<"$2"
}
setup() {
mkdir -p "$RBENV_TEST_DIR"
cd "$RBENV_TEST_DIR"
@ -45,11 +38,12 @@ setup() {
}
@test "reports from hook" {
touch .ruby-version
create_hook test.bash "RBENV_VERSION_ORIGIN=plugin"
RBENV_VERSION=1 run rbenv-version-origin
mkdir -p "${RBENV_ROOT}/rbenv.d/version-origin"
cat > "${RBENV_ROOT}/rbenv.d/version-origin/test.bash" <<HOOK
RBENV_VERSION_ORIGIN=plugin
HOOK
RBENV_VERSION=1 RBENV_HOOK_PATH="${RBENV_ROOT}/rbenv.d" run rbenv-version-origin
assert_success "plugin"
}