Skip to content

Commit

Permalink
Merge pull request #1600 from mikelolasagasti/fix-127
Browse files Browse the repository at this point in the history
Skip BW01 and BW02 error messages during tests
  • Loading branch information
mislav authored Dec 11, 2024
2 parents a43095d + e5c7eb3 commit efeab7f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions test/which.bats
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ create_executable() {
}

@test "doesn't include current directory in PATH search" {
bats_require_minimum_version 1.5.0
mkdir -p "$RBENV_TEST_DIR"
cd "$RBENV_TEST_DIR"
touch kill-all-humans
chmod +x kill-all-humans
PATH="$(path_without "kill-all-humans")" RBENV_VERSION=system run rbenv-which kill-all-humans
PATH="$(path_without "kill-all-humans")" RBENV_VERSION=system run -127 rbenv-which kill-all-humans
assert_failure "rbenv: kill-all-humans: command not found"
}

Expand All @@ -72,22 +73,25 @@ create_executable() {
}

@test "no executable found" {
bats_require_minimum_version 1.5.0
create_executable "1.8" "rspec"
RBENV_VERSION=1.8 run rbenv-which rake
RBENV_VERSION=1.8 run -127 rbenv-which rake
assert_failure "rbenv: rake: command not found"
}

@test "no executable found for system version" {
PATH="$(path_without "rake")" RBENV_VERSION=system run rbenv-which rake
bats_require_minimum_version 1.5.0
PATH="$(path_without "rake")" RBENV_VERSION=system run -127 rbenv-which rake
assert_failure "rbenv: rake: command not found"
}

@test "executable found in other versions" {
bats_require_minimum_version 1.5.0
create_executable "1.8" "ruby"
create_executable "1.9" "rspec"
create_executable "2.0" "rspec"

RBENV_VERSION=1.8 run rbenv-which rspec
RBENV_VERSION=1.8 run -127 rbenv-which rspec
assert_failure
assert_output <<OUT
rbenv: rspec: command not found
Expand All @@ -99,9 +103,10 @@ OUT
}

@test "executable not found in user gems" {
bats_require_minimum_version 1.5.0
create_executable "2.7.6" "ruby"
create_executable "${HOME}/.gem/ruby/2.7.0/bin" "rake"
GEM_HOME='' RBENV_VERSION=2.7.6 run rbenv-which rake
GEM_HOME='' RBENV_VERSION=2.7.6 run -127 rbenv-which rake
assert_failure
}

Expand Down

0 comments on commit efeab7f

Please sign in to comment.