class Minitest::RG

def puts o = nil

def puts o = nil
  return io.puts if o.nil?
  if o =~ /(\d+) failures, (\d+) errors/
    if Regexp.last_match[1] != "0" || Regexp.last_match[2] != "0"
      io.puts "\e[31m#{o}\e[0m"
    else
      io.puts "\e[32m#{o}\e[0m"
    end
  else
    io.puts o
  end
end