Merge pull request #1096 from chef/ap/fix-fail-message

Include code description in the output of failed controls
This commit is contained in:
Christoph Hartmann 2016-09-20 11:24:07 +02:00 committed by GitHub
commit e16a7e8ab4
2 changed files with 7 additions and 3 deletions

View file

@ -411,7 +411,11 @@ class InspecRspecCli < InspecRspecJson # rubocop:disable Metrics/ClassLength
test_color = @colors[test_status]
indicator = @indicators[x[:status]]
indicator = @indicators['empty'] if indicator.nil?
msg = x[:message] || x[:skip_message] || x[:code_desc]
if x[:message]
msg = x[:code_desc] + "\n" + x[:message]
else
msg = x[:skip_message] || x[:code_desc]
end
print_line(
color: test_color,
indicator: @indicators['small'] + indicator,

View file

@ -160,7 +160,7 @@ Test Summary: \e[32m2 successful\e[0m, \e[31m0 failures\e[0m, \e[37m0 skipped\e[
out.stdout.force_encoding(Encoding::UTF_8).must_include "✖ tmp-1.0: Create /tmp directory (1 failed)\e[0m"
out.stdout.force_encoding(Encoding::UTF_8).must_include "✖ should not be directory"
out.stdout.force_encoding(Encoding::UTF_8).must_include "✖ undefined method `should_nota'"
out.stdout.force_encoding(Encoding::UTF_8).must_include "expected `File /tmp.directory?` to return false, got true\e[0m"
out.stdout.force_encoding(Encoding::UTF_8).must_include "should not be directory\n expected `File /tmp.directory?` to return false, got true\e[0m"
end
end
@ -171,7 +171,7 @@ Test Summary: \e[32m2 successful\e[0m, \e[31m0 failures\e[0m, \e[37m0 skipped\e[
out.stdout.force_encoding(Encoding::UTF_8).must_include "✖ tmp-1.0: Create /tmp directory (1 failed)\e[0m"
out.stdout.force_encoding(Encoding::UTF_8).must_include "✖ should not be directory"
out.stdout.force_encoding(Encoding::UTF_8).must_include "✖ undefined method `should_nota'"
out.stdout.force_encoding(Encoding::UTF_8).must_include "expected `File /tmp.directory?` to return false, got true\e[0m"
out.stdout.force_encoding(Encoding::UTF_8).must_include "should not be directory\n expected `File /tmp.directory?` to return false, got true\e[0m"
out.stdout.force_encoding(Encoding::UTF_8).must_include "✔ profiled-1: Create /tmp directory (profile d)"
end
end