49 lines
1.2 KiB
Bash
Executable File
49 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bats
|
|
|
|
load ../test_helper
|
|
load ../../lib/helpers
|
|
load ../../lib/composure
|
|
load ../../plugins/available/ruby.plugin
|
|
|
|
function local_setup {
|
|
mkdir -p "$BASH_IT"
|
|
lib_directory="$(cd "$(dirname "$0")" && pwd)"
|
|
# Use rsync to copy Bash-it to the temp folder
|
|
# rsync is faster than cp, since we can exclude the large ".git" folder
|
|
rsync -qavrKL -d --delete-excluded --exclude=.git $lib_directory/../../.. "$BASH_IT"
|
|
|
|
rm -rf "$BASH_IT"/enabled
|
|
rm -rf "$BASH_IT"/aliases/enabled
|
|
rm -rf "$BASH_IT"/completion/enabled
|
|
rm -rf "$BASH_IT"/plugins/enabled
|
|
|
|
mkdir -p "$BASH_IT"/enabled
|
|
mkdir -p "$BASH_IT"/aliases/enabled
|
|
mkdir -p "$BASH_IT"/completion/enabled
|
|
mkdir -p "$BASH_IT"/plugins/enabled
|
|
|
|
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" {
|
|
run type remove_gem
|
|
assert_line 1 "remove_gem () "
|
|
}
|
|
|
|
@test "plugins ruby: PATH includes ~/.gem/ruby/bin" {
|
|
if ! which ruby >/dev/null; then
|
|
skip 'ruby not installed'
|
|
fi
|
|
|
|
load ../../plugins/available/ruby.plugin
|
|
|
|
local last_path_entry=$(echo $PATH | tr ":" "\n" | tail -1)
|
|
[[ "${last_path_entry}" == "${HOME}"/.gem/ruby/*/bin ]]
|
|
}
|