Consolidate tests and verify output contents

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
This commit is contained in:
Jerry Aldrich 2019-01-27 17:46:42 -08:00
parent 7f4560ea7c
commit b801bbca1c
2 changed files with 31 additions and 22 deletions

View file

@ -30,14 +30,42 @@ describe 'command tests' do
end
describe 'help' do
it 'outputs the same message when using `help`, `--help`, or no args' do
outputs = [
let(:outputs) {
[
inspec('help').stdout,
inspec('--help').stdout,
inspec('').stdout,
]
}
it 'outputs the same message regardless of invocation' do
outputs.uniq.length.must_equal 1
end
it 'outputs both core commands and v2 CLI plugins' do
commands = %w{
archive
artifact
check
compliance
detect
env
exec
habitat
help
init
json
plugin
shell
supermarket
vendor
version
}
outputs.each do |output|
commands.each do |subcommand|
output.must_include('inspec ' + subcommand)
end
end
end
end
end

View file

@ -62,25 +62,6 @@ end
#=========================================================================================#
# See lib/plugins/inspec-plugin-manager-cli/test
#=========================================================================================#
# CLI Usage Messaging
#=========================================================================================#
describe 'plugin cli usage message integration' do
include FunctionalHelper
[' help', ''].each do |invocation|
it "includes v2 plugins in `inspec#{invocation}` output" do
outcome = inspec(invocation)
outcome.stderr.must_equal ''
# These are some subcommands provided by core v2 plugins
['habitat', 'artifact'].each do |subcommand|
outcome.stdout.must_include('inspec ' + subcommand)
end
end
end
end
#=========================================================================================#
# DSL Plugin Support
#=========================================================================================#
@ -258,4 +239,4 @@ describe 'train plugin support' do
outcome.stdout.chomp.must_equal "Mock Command Result stdout"
end
end
end
end