From 6e300322789b7809cb70a97948dd19c163b02a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Wed, 23 Dec 2015 17:32:21 +0100 Subject: [PATCH] Simplify version-name, version-origin hook tests No need for helper function that's gonna be used just once. --- test/version-name.bats | 16 +++++----------- test/version-origin.bats | 16 +++++----------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/test/version-name.bats b/test/version-name.bats index ef283283..82e1b2d0 100644 --- a/test/version-name.bats +++ b/test/version-name.bats @@ -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" < "${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" <