Better tests, more resilience and a bug fix
This commit is contained in:
10
test/lib/helpers.bats
Normal file
10
test/lib/helpers.bats
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load ../../lib/composure
|
||||
load ../../plugins/available/base.plugin
|
||||
|
||||
cite _about _param _example _group _author _version
|
||||
|
||||
load ../../lib/helpers
|
||||
|
||||
## TODO: write some tests.
|
||||
@@ -15,19 +15,39 @@ NO_COLOR=true
|
||||
[[ "${lines[0]}" =~ 'plugins' && "${lines[0]}" =~ 'base' ]]
|
||||
}
|
||||
|
||||
@test "helpers search all ruby et al" {
|
||||
@test "helpers search ruby gem bundle rake rails" {
|
||||
# first disable them all, so that the output does not appear with a checkbox
|
||||
# and we can compoare the result
|
||||
run _bash-it-search 'ruby' 'gem' 'bundle' 'rake' 'rails' '--disable'
|
||||
# Now perform the search
|
||||
run _bash-it-search 'ruby' 'gem' 'bundle' 'rake' 'rails'
|
||||
[[ "${lines[0]/✓/}" == ' aliases => bundler rails' ]]
|
||||
[[ "${lines[1]/✓/}" == ' plugins => chruby chruby-auto ruby' ]]
|
||||
# And verify
|
||||
[[ "${lines[0]/✓/}" == ' aliases => bundler rails' ]] && \
|
||||
[[ "${lines[1]/✓/}" == ' plugins => chruby chruby-auto ruby' ]] && \
|
||||
[[ "${lines[2]/✓/}" == ' completions => bundler gem rake' ]]
|
||||
}
|
||||
|
||||
@test "search enable and disable" {
|
||||
@test "search ruby gem bundle -chruby rake rails" {
|
||||
run _bash-it-search 'ruby' 'gem' 'bundle' 'rake' 'rails' '--disable'
|
||||
run _bash-it-search 'ruby' 'gem' 'bundle' '-chruby' 'rake' 'rails'
|
||||
[[ "${lines[0]/✓/}" == ' aliases => bundler rails' ]] && \
|
||||
[[ "${lines[1]/✓/}" == ' plugins => ruby' ]] && \
|
||||
[[ "${lines[2]/✓/}" == ' completions => bundler gem rake' ]]
|
||||
}
|
||||
|
||||
@test "search (rails enabled) ruby gem bundle rake rails" {
|
||||
run _bash-it-search 'ruby' 'gem' 'bundle' 'rake' 'rails' '--disable'
|
||||
run _enable-alias 'rails'
|
||||
run _bash-it-search 'ruby' 'gem' 'bundle' 'rake' 'rails'
|
||||
[[ "${lines[0]}" == ' aliases => bundler ✓rails' ]]
|
||||
[[ "${lines[1]}" == ' plugins => chruby chruby-auto ruby' ]]
|
||||
[[ "${lines[2]}" == ' completions => bundler gem rake' ]]
|
||||
[[ "${lines[0]}" == ' aliases => bundler ✓rails' ]] && \
|
||||
[[ "${lines[1]}" == ' plugins => chruby chruby-auto ruby' ]] && \
|
||||
[[ "${lines[2]}" == ' completions => bundler gem rake' ]]
|
||||
}
|
||||
|
||||
@test "search (all enabled) ruby gem bundle rake rails" {
|
||||
run _bash-it-search 'ruby' 'gem' 'bundle' 'rake' '-chruby' 'rails' '--enable'
|
||||
run _bash-it-search 'ruby' 'gem' 'bundle' 'rake' '-chruby' 'rails'
|
||||
[[ "${lines[0]}" == ' aliases => ✓bundler ✓rails' ]] && \
|
||||
[[ "${lines[1]}" == ' plugins => ✓ruby' ]] && \
|
||||
[[ "${lines[2]}" == ' completions => ✓bundler ✓gem ✓rake' ]]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user