diff --git a/test/exec.bats b/test/exec.bats index 9b163689..45e7f731 100644 --- a/test/exec.bats +++ b/test/exec.bats @@ -67,16 +67,29 @@ SH @test "supports ruby -S " { export RBENV_VERSION="2.0" - create_executable "ruby" "#!$BASH - if [[ \$1 = '-S' ]]; then - head -1 \$(which \$2) | grep ruby >/dev/null - exit \$? - else - echo 'ruby 2.0 (rbenv test)' - fi" - create_executable "rake" "#!/usr/bin/env ruby" + + # emulate `ruby -S' behavior + create_executable "ruby" </dev/null; then + \$BASH "\$found" + else + echo "ruby: no Ruby script found in input (LoadError)" >&2 + exit 1 + fi +else + echo 'ruby 2.0 (rbenv test)' +fi +SH + + create_executable "rake" "\ + #!/usr/bin/env ruby + echo hello rake" rbenv-rehash run ruby -S rake - assert_success + assert_success "hello rake" }