Class: Turn::DotReporter

Inherits:
Reporter show all
Defined in:
lib/turn/reporters/dot_reporter.rb

Overview

Traditional Dot Reporter

Constant Summary

Constants included from Colorize

Colorize::COLORIZE, Colorize::ERROR, Colorize::FAIL, Colorize::PASS, Colorize::SKIP

Instance Attribute Summary

Attributes inherited from Reporter

#io

Instance Method Summary collapse

Methods inherited from Reporter

#initialize

Methods included from Colorize

blue, bold, error, fail, green, magenta, pass, red, skip

Constructor Details

This class inherits a constructor from Turn::Reporter

Instance Method Details

#error(message = nil) ⇒ Object



29
30
31
# File 'lib/turn/reporters/dot_reporter.rb', line 29

def error(message=nil)
  io.print Colorize.error('E'); io.flush
end

#fail(message = nil) ⇒ Object



25
26
27
# File 'lib/turn/reporters/dot_reporter.rb', line 25

def fail(message=nil)
  io.print Colorize.fail('F'); io.flush
end

#finish_case(kase) ⇒ Object



36
37
# File 'lib/turn/reporters/dot_reporter.rb', line 36

def finish_case(kase)
end

#finish_suite(suite) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/turn/reporters/dot_reporter.rb', line 39

def finish_suite(suite)
  io.puts("\nFinished in %.5f seconds." % [Time.now - @time])

  report = ''

  list = []
  suite.each do |testcase|
    testcase.each do |testunit|
      if testunit.fail? || testunit.error?
        list << testunit
      end
    end
  end

  unless list.empty? # or verbose?
    #report << "\n\n-- Failures and Errors --\n\n"
    list.uniq.each do |testunit|
      message = testunit.fail? ? ' ' + FAIL : ERROR
      message = message + ' ' + testunit.message.tabto(0)
      message << "\n" + (filter_backtrace(testunit.backtrace).first || '')
      report << "\n" << message << "\n"
    end
    report << "\n"
  end

  io.puts report

  count = test_tally(suite)

  tally = "%s tests, %s assertions, %s failures, %s errors" % count
 
  if count[-1] > 0 or count[-2] > 0
    tally = Colorize.red(tally)
  else
    tally = Colorize.green(tally)
  end

  io.puts tally
end

#finish_test(test) ⇒ Object



33
34
# File 'lib/turn/reporters/dot_reporter.rb', line 33

def finish_test(test)
end

#pass(message = nil) ⇒ Object



21
22
23
# File 'lib/turn/reporters/dot_reporter.rb', line 21

def pass(message=nil)
  io.print Colorize.pass('.'); io.flush
end

#start_case(kase) ⇒ Object



15
16
# File 'lib/turn/reporters/dot_reporter.rb', line 15

def start_case(kase)
end

#start_suite(suite) ⇒ Object



9
10
11
12
13
# File 'lib/turn/reporters/dot_reporter.rb', line 9

def start_suite(suite)
  @time = Time.now
  io.puts "Loaded suite #{suite.name}"
  io.puts "Started"
end

#start_test(test) ⇒ Object



18
19
# File 'lib/turn/reporters/dot_reporter.rb', line 18

def start_test(test)
end