diff --git a/lib/fitting/log.rb b/lib/fitting/log.rb index 6c84c4d..e17b8bd 100644 --- a/lib/fitting/log.rb +++ b/lib/fitting/log.rb @@ -96,10 +96,14 @@ def self.report(logs) Fitting::Log.failure(logs).each_with_index do |log, index| puts "\e[31m #{index + 1}) #{log.error.class} #{log.error.message}\n\n\e[0m" end - print "\e[31m#{logs.size} examples, #{Fitting::Log.failure(logs).size} failure, #{Fitting::Log.pending(logs).size} pending\e[0m\n" + + failure_count = Fitting::Log.failure(logs).size + color_code = failure_count > 0 ? 31 : 32 + print "\e[#{color_code}m#{logs.size} examples, #{failure_count} failure, #{Fitting::Log.pending(logs).size} pending\e[0m\n" + unless Fitting::Log.failure(logs).size <= 0 exit 1 end end end -end \ No newline at end of file +end