Have rbenv local read version from parent directories as well

Fixes #807
This commit is contained in:
Mislav Marohnić 2015-12-23 15:21:24 +01:00
parent ca25259900
commit ba072adcb9
2 changed files with 7 additions and 6 deletions

View file

@ -47,9 +47,10 @@ elif [ -n "$RBENV_VERSION" ]; then
} >&2
fi
else
rbenv-version-file-read .ruby-version ||
rbenv-version-file-read .rbenv-version ||
{ echo "rbenv: no local version configured for this directory"
if version_file="$(rbenv-version-file "$PWD")"; then
rbenv-version-file-read "$version_file"
else
echo "rbenv: no local version configured for this directory" >&2
exit 1
} >&2
fi
fi

View file

@ -32,11 +32,11 @@ setup() {
assert_success "2.0"
}
@test "ignores version in parent directory" {
@test "discovers version file in parent directory" {
echo "1.2.3" > .ruby-version
mkdir -p "subdir" && cd "subdir"
run rbenv-local
assert_failure
assert_success "1.2.3"
}
@test "ignores RBENV_DIR" {