Skip to content

Commit efeab7f

Browse files
authored
Merge pull request #1600 from mikelolasagasti/fix-127
Skip BW01 and BW02 error messages during tests
2 parents a43095d + e5c7eb3 commit efeab7f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

test/which.bats

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,12 @@ create_executable() {
5757
}
5858

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

@@ -72,22 +73,25 @@ create_executable() {
7273
}
7374

7475
@test "no executable found" {
76+
bats_require_minimum_version 1.5.0
7577
create_executable "1.8" "rspec"
76-
RBENV_VERSION=1.8 run rbenv-which rake
78+
RBENV_VERSION=1.8 run -127 rbenv-which rake
7779
assert_failure "rbenv: rake: command not found"
7880
}
7981

8082
@test "no executable found for system version" {
81-
PATH="$(path_without "rake")" RBENV_VERSION=system run rbenv-which rake
83+
bats_require_minimum_version 1.5.0
84+
PATH="$(path_without "rake")" RBENV_VERSION=system run -127 rbenv-which rake
8285
assert_failure "rbenv: rake: command not found"
8386
}
8487

8588
@test "executable found in other versions" {
89+
bats_require_minimum_version 1.5.0
8690
create_executable "1.8" "ruby"
8791
create_executable "1.9" "rspec"
8892
create_executable "2.0" "rspec"
8993

90-
RBENV_VERSION=1.8 run rbenv-which rspec
94+
RBENV_VERSION=1.8 run -127 rbenv-which rspec
9195
assert_failure
9296
assert_output <<OUT
9397
rbenv: rspec: command not found
@@ -99,9 +103,10 @@ OUT
99103
}
100104

101105
@test "executable not found in user gems" {
106+
bats_require_minimum_version 1.5.0
102107
create_executable "2.7.6" "ruby"
103108
create_executable "${HOME}/.gem/ruby/2.7.0/bin" "rake"
104-
GEM_HOME='' RBENV_VERSION=2.7.6 run rbenv-which rake
109+
GEM_HOME='' RBENV_VERSION=2.7.6 run -127 rbenv-which rake
105110
assert_failure
106111
}
107112

0 commit comments

Comments
 (0)