test/ruby: adopt newly revamped `setup()`

pull/2031/head
John D Pell 2022-01-31 11:09:09 -08:00 committed by John D Pell
parent fbf7efa1b8
commit a36a4c4038
1 changed files with 10 additions and 17 deletions

27
test/plugins/ruby.plugin.bats 100755 → 100644
View File

@ -1,24 +1,15 @@
#!/usr/bin/env bats
# shellcheck shell=bats
load ../test_helper
load ../test_helper_libs
load "${MAIN_BASH_IT_DIR?}/test/test_helper.bash"
function local_setup {
setup_test_fixture
_command_exists "ruby" && mkdir -p "$(ruby -e 'print Gem.user_dir')/bin"
export OLD_PATH="$PATH"
export PATH="/usr/bin:/bin:/usr/sbin"
}
function local_teardown {
export PATH="$OLD_PATH"
unset OLD_PATH
function local_setup_file() {
setup_libs "helpers"
}
@test "plugins ruby: remove_gem is defined" {
load ../../plugins/available/ruby.plugin
run load "${BASH_IT?}/plugins/available/ruby.plugin.bash"
assert_success
load "${BASH_IT?}/plugins/available/ruby.plugin.bash"
run type remove_gem
assert_line -n 1 "remove_gem () "
@ -31,7 +22,9 @@ function local_teardown {
mkdir -p "$(ruby -e 'print Gem.user_dir')/bin"
load ../../plugins/available/ruby.plugin
run load "${BASH_IT?}/plugins/available/ruby.plugin.bash"
assert_success
load "${BASH_IT?}/plugins/available/ruby.plugin.bash"
local last_path_entry="$(tail -1 <<<"${PATH//:/$'\n'}")"
[[ "${last_path_entry}" == "$(ruby -e 'print Gem.user_dir')/bin" ]]