test/ruby: adopt newly revamped `setup()`
parent
fbf7efa1b8
commit
a36a4c4038
|
|
@ -1,24 +1,15 @@
|
||||||
#!/usr/bin/env bats
|
# shellcheck shell=bats
|
||||||
|
|
||||||
load ../test_helper
|
load "${MAIN_BASH_IT_DIR?}/test/test_helper.bash"
|
||||||
load ../test_helper_libs
|
|
||||||
|
|
||||||
function local_setup {
|
function local_setup_file() {
|
||||||
setup_test_fixture
|
setup_libs "helpers"
|
||||||
|
|
||||||
_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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "plugins ruby: remove_gem is defined" {
|
@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
|
run type remove_gem
|
||||||
assert_line -n 1 "remove_gem () "
|
assert_line -n 1 "remove_gem () "
|
||||||
|
|
@ -31,7 +22,9 @@ function local_teardown {
|
||||||
|
|
||||||
mkdir -p "$(ruby -e 'print Gem.user_dir')/bin"
|
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'}")"
|
local last_path_entry="$(tail -1 <<<"${PATH//:/$'\n'}")"
|
||||||
[[ "${last_path_entry}" == "$(ruby -e 'print Gem.user_dir')/bin" ]]
|
[[ "${last_path_entry}" == "$(ruby -e 'print Gem.user_dir')/bin" ]]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue