Colorize result string based on outcome

This commit is contained in:
Michael Miller 2018-09-15 13:51:28 -06:00
parent 8e1a2e114b
commit 625262b6d5

View file

@ -39,7 +39,14 @@ module Spectator
failures = results.failed_examples failures = results.failed_examples
errors = results.errored_examples errors = results.errored_examples
pending = results.pending_examples pending = results.pending_examples
"#{examples} examples, #{failures} failures, #{errors} errors, #{pending} pending" string = "#{examples} examples, #{failures} failures, #{errors} errors, #{pending} pending"
if failures > 0 || errors > 0
string.colorize.red
elsif pending != examples
string.colorize.yellow
else
string.colorize.green
end
end end
private def human_time(span : Time::Span) private def human_time(span : Time::Span)