Class: MiniTest::Unit

Inherits:
Object
  • Object
show all
Defined in:
lib/colorific.rb

Constant Summary collapse

ANSI_COLOR_CODES =
{ :clear => "\e[0m", :red => "\e[31m", :green => "\e[32m", :yellow => "\e[33m" }
TEST_COLORS =
{ "F" => :red, "E" => :red, "S" => :yellow, "." => :green }

Instance Method Summary collapse

Instance Method Details

#_run_suites(suites, type) ⇒ Object



25
26
27
28
29
30
# File 'lib/colorific.rb', line 25

def _run_suites(suites, type)
  @colorful_test_count = suites.reduce(0) { |mem, suite| mem + suite.send("#{type}_methods").size }
  @finished_count = 0
  @progress_bar = ProgressBar.new("  #{test_count} tests", @colorful_test_count, output)
  original_run_suites(suites, type)
end

#original_pukeObject



9
# File 'lib/colorific.rb', line 9

alias :original_puke :puke

#original_run_suitesObject



10
# File 'lib/colorific.rb', line 10

alias :original_run_suites :_run_suites

#original_statusObject



11
# File 'lib/colorific.rb', line 11

alias :original_status :status


36
37
38
39
40
41
42
43
# File 'lib/colorific.rb', line 36

def print(*a)
  if %w(. S F E).include?(a.join)
    set_color(a.join)
    increment
  else
    output.print(*a)
  end
end

#puke(klass, meth, e) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/colorific.rb', line 13

def puke(klass, meth, e)
  r = original_puke(klass, meth, e)

  if report = @report.pop
    lines = report.split(/\n/)
    lines[0] = tint(r, lines[0])
    @report << lines.join("\n")
  end
  
  return r
end

#status(io = self.output) ⇒ Object



32
33
34
# File 'lib/colorific.rb', line 32

def status(io = self.output)
  with_color { original_status(io) }
end