#!/usr/bin/env bats load test_helper create_version() { mkdir -p "${RBENV_ROOT}/versions/$1" } setup() { mkdir -p "$RBENV_TEST_DIR" cd "$RBENV_TEST_DIR" } stub_system_ruby() { local stub="${RBENV_TEST_DIR}/bin/ruby" mkdir -p "$(dirname "$stub")" touch "$stub" && chmod +x "$stub" } @test "no versions installed" { stub_system_ruby assert [ ! -d "${RBENV_ROOT}/versions" ] run rbenv-versions assert_success "* system (set by ${RBENV_ROOT}/version)" } @test "bare output no versions installed" { assert [ ! -d "${RBENV_ROOT}/versions" ] run rbenv-versions --bare assert_success "" } @test "single version installed" { stub_system_ruby create_version "1.9" run rbenv-versions assert_success assert_output < "${RBENV_ROOT}/version" <<<"1.9.3" run rbenv-versions assert_success assert_output < ".ruby-version" <<<"1.9.3" run rbenv-versions assert_success assert_output <