class Minitest::PrideIO
def self.pride!
def self.pride! @pride = true end
def self.pride?
def self.pride? @pride ||= false end
def initialize io # :nodoc:
def initialize io # :nodoc: @io = io # stolen from /System/Library/Perl/5.10.0/Term/ANSIColor.pm # also reference http://en.wikipedia.org/wiki/ANSI_escape_code @colors ||= (31..36).to_a @size = @colors.size @index = 0 end
def method_missing msg, *args # :nodoc:
def method_missing msg, *args # :nodoc: io.send(msg, *args) end
def pride string
def pride string string = "*" if string == "." c = @colors[@index % @size] @index += 1 "#{ESC}#{c}m#{string}#{NND}" end
def print o
def print o case o when "." then io.print pride o when "E", "F" then io.print "#{ESC}41m#{ESC}37m#{o}#{NND}" when "S" then io.print pride o else io.print o end end
def puts(*o) # :nodoc:
def puts(*o) # :nodoc: o.map! { |s| s.to_s.sub(/Finished/) { @index = 0 "Fabulous run".split(//).map { |c| pride(c) }.join } } io.puts(*o) end