2013-03-07 20:05:49 +00:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
load test_helper
|
|
|
|
|
|
|
|
@test "no shell version" {
|
|
|
|
mkdir -p "${RBENV_TEST_DIR}/myproject"
|
|
|
|
cd "${RBENV_TEST_DIR}/myproject"
|
|
|
|
echo "1.2.3" > .ruby-version
|
|
|
|
RBENV_VERSION="" run rbenv-sh-shell
|
|
|
|
assert_failure "rbenv: no shell-specific version configured"
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "shell version" {
|
2013-09-28 16:43:39 +00:00
|
|
|
RBENV_SHELL=bash RBENV_VERSION="1.2.3" run rbenv-sh-shell
|
2013-08-15 14:01:13 +00:00
|
|
|
assert_success 'echo "$RBENV_VERSION"'
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "shell version (fish)" {
|
2013-09-28 16:43:39 +00:00
|
|
|
RBENV_SHELL=fish RBENV_VERSION="1.2.3" run rbenv-sh-shell
|
2013-03-07 20:05:49 +00:00
|
|
|
assert_success 'echo "$RBENV_VERSION"'
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "shell unset" {
|
2013-09-28 16:43:39 +00:00
|
|
|
RBENV_SHELL=bash run rbenv-sh-shell --unset
|
2013-03-07 20:05:49 +00:00
|
|
|
assert_success "unset RBENV_VERSION"
|
|
|
|
}
|
|
|
|
|
2013-08-15 14:01:13 +00:00
|
|
|
@test "shell unset (fish)" {
|
2013-09-28 16:43:39 +00:00
|
|
|
RBENV_SHELL=fish run rbenv-sh-shell --unset
|
2013-08-15 14:01:13 +00:00
|
|
|
assert_success "set -e RBENV_VERSION"
|
|
|
|
}
|
|
|
|
|
2013-03-07 20:05:49 +00:00
|
|
|
@test "shell change invalid version" {
|
|
|
|
run rbenv-sh-shell 1.2.3
|
2013-04-06 12:10:44 +00:00
|
|
|
assert_failure
|
|
|
|
assert_output <<SH
|
|
|
|
rbenv: version \`1.2.3' not installed
|
2013-08-15 14:01:13 +00:00
|
|
|
false
|
2013-04-06 12:10:44 +00:00
|
|
|
SH
|
2013-03-07 20:05:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "shell change version" {
|
|
|
|
mkdir -p "${RBENV_ROOT}/versions/1.2.3"
|
2013-09-28 16:43:39 +00:00
|
|
|
RBENV_SHELL=bash run rbenv-sh-shell 1.2.3
|
2013-03-07 20:05:49 +00:00
|
|
|
assert_success 'export RBENV_VERSION="1.2.3"'
|
|
|
|
}
|
2013-08-15 14:01:13 +00:00
|
|
|
|
|
|
|
@test "shell change version (fish)" {
|
|
|
|
mkdir -p "${RBENV_ROOT}/versions/1.2.3"
|
2013-09-28 16:43:39 +00:00
|
|
|
RBENV_SHELL=fish run rbenv-sh-shell 1.2.3
|
2013-08-15 14:01:13 +00:00
|
|
|
assert_success 'setenv RBENV_VERSION "1.2.3"'
|
|
|
|
}
|