class MiniTest::RG

Constants

COLORS
VERSION

Attributes

colors[R]
io[R]

Public Class Methods

new(io, colors = COLORS) click to toggle source
# File lib/minitest/rg_plugin.rb, line 41
def initialize io, colors = COLORS
  @io     = io
  @colors = colors
end
rg!() click to toggle source
# File lib/minitest/rg_plugin.rb, line 33
def self.rg!
  @rg = true
end
rg?() click to toggle source
# File lib/minitest/rg_plugin.rb, line 37
def self.rg?
  @rg ||= false
end

Public Instance Methods

method_missing(msg, *args) click to toggle source
Calls superclass method
# File lib/minitest/rg_plugin.rb, line 63
def method_missing msg, *args
  return super unless io.respond_to? msg
  io.send(msg, *args)
end
print(o) click to toggle source
puts(o=nil) click to toggle source
# File lib/minitest/rg_plugin.rb, line 50
def puts o=nil
  return io.puts if o.nil?
  if o =~ /(\d+) failures, (\d+) errors/
    if $1 != '0' || $2 != '0'
      io.puts "\e[31m#{o}\e[0m"
    else
      io.puts "\e[32m#{o}\e[0m"
    end
  else
    io.puts o
  end
end