From: Piper McCorkle <piperswe@gmail.com>
Date: Tue, 7 Apr 2020 00:07:46 -0700
Subject: Fix nonexistent version test to work regardless of env.

---
 test/rbenv.bats | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/test/rbenv.bats b/test/rbenv.bats
index eb6ade1..cef6bec 100644
--- a/test/rbenv.bats
+++ b/test/rbenv.bats
@@ -57,7 +57,8 @@ OUT
 
   run rbenv-install 1.9.3
   assert_failure
-  assert_output <<OUT
+  (
+    cat <<OUT
 ERROR
 
 The following versions contain \`1.9.3' in the name:
@@ -66,10 +67,19 @@ The following versions contain \`1.9.3' in the name:
 
 See all available versions with \`rbenv install --list'.
 
-If the version you need is missing, try upgrading ruby-build:
-
-  git -C ${BATS_TEST_DIRNAME}/.. pull
 OUT
+    here="${BATS_TEST_DIRNAME}/.."
+    echo -n "If the version you need is missing, try upgrading ruby-build"
+    if [ "$here" != "${here#$(brew --prefix 2>/dev/null)}" ]; then
+      printf ":\n\n"
+      echo "  brew update && brew upgrade ruby-build"
+    elif [ -d "${here}/.git" ]; then
+      printf ":\n\n"
+      echo "  git -C ${here} pull"
+    else
+      printf ".\n"
+    fi
+  ) | assert_output
 
   unstub ruby-build
 }
