diff --git a/libexec/rbenv-version-file b/libexec/rbenv-version-file index c0550d64..a8335950 100755 --- a/libexec/rbenv-version-file +++ b/libexec/rbenv-version-file @@ -9,7 +9,7 @@ target_dir="$1" find_local_version_file() { local root="$1" while ! [[ "$root" =~ ^//[^/]*$ ]]; do - if [ -f "${root}/.ruby-version" ]; then + if [ -s "${root}/.ruby-version" ]; then echo "${root}/.ruby-version" return 0 fi diff --git a/test/version-file.bats b/test/version-file.bats index d8cc74e3..075b002d 100644 --- a/test/version-file.bats +++ b/test/version-file.bats @@ -9,7 +9,7 @@ setup() { create_file() { mkdir -p "$(dirname "$1")" - touch "$1" + echo "system" > "$1" } @test "detects global 'version' file" { diff --git a/test/version-origin.bats b/test/version-origin.bats index 7bca376d..55138920 100644 --- a/test/version-origin.bats +++ b/test/version-origin.bats @@ -26,7 +26,7 @@ setup() { } @test "detects local file" { - touch .ruby-version + echo "system" > .ruby-version run rbenv-version-origin assert_success "${PWD}/.ruby-version" }