rbenv/test/global.bats
Jason Karns fe809ea90d Remove support for legacy global version files
`default` was made legacy back in 2011 with
5be66da9f4 (the command was renamed from
`rbenv-default` to `rbenv-global`, and so the global file was renamed
from `$RBENV_ROOT/default` to `$RBENV_ROOT/global` (the latter taking
precedence)

`global` was then made legacy about a month later in Sep 2011 when the
preferred filename was changed to `$RBENV_ROOT/version`.
2015-12-28 22:05:00 -05:00

31 lines
607 B
Bash

#!/usr/bin/env bats
load test_helper
@test "default" {
run rbenv-global
assert_success
assert_output "system"
}
@test "read RBENV_ROOT/version" {
mkdir -p "$RBENV_ROOT"
echo "1.2.3" > "$RBENV_ROOT/version"
run rbenv-global
assert_success
assert_output "1.2.3"
}
@test "set RBENV_ROOT/version" {
mkdir -p "$RBENV_ROOT/versions/1.2.3"
run rbenv-global "1.2.3"
assert_success
run rbenv-global
assert_success "1.2.3"
}
@test "fail setting invalid RBENV_ROOT/version" {
mkdir -p "$RBENV_ROOT"
run rbenv-global "1.2.3"
assert_failure "rbenv: version \`1.2.3' not installed"
}