class Tapout::Reporters::DotReporter

Traditional dot progress reporter.

Public Instance Methods

error(entry) click to toggle source
Calls superclass method Tapout::Reporters::Abstract#error
# File lib/tapout/reporters/dot_reporter.rb, line 32
def error(entry)
  $stdout.print 'E'.ansi(*config.error)
  $stdout.flush
  super(entry)
end
fail(entry) click to toggle source
Calls superclass method Tapout::Reporters::Abstract#fail
# File lib/tapout/reporters/dot_reporter.rb, line 25
def fail(entry)
  $stdout.print 'F'.ansi(*config.fail)
  $stdout.flush
  super(entry)
end
finish_suite(entry) click to toggle source
# File lib/tapout/reporters/dot_reporter.rb, line 39
def finish_suite(entry)
  $stdout.puts "\n\n"

  i = 1

  @failed.each do |test|
    label     = test['label'].to_s
    snippets  = backtrace_snippets(test)
    errclass  = test['exception']['class']
    message   = test['exception']['message']
    capture   = captured_output(test)
 
    parts = [errclass, message, snippets, capture].compact.map{ |e| e.strip }.reject{ |e| e.empty? }

    puts "#{i}. " + "FAIL".ansi(*config.error) + " " + label.ansi(*config.fail)
    puts
    puts parts.join("\n\n").tabto(4)
    puts

    i += 1
  end

  @raised.each do |test|
    label     = test['label'].to_s
    snippets  = backtrace_snippets(test)
    errclass  = test['exception']['class']
    message   = test['exception']['message']
    capture   = captured_output(test)
 
    parts = [errclass, message, snippets, capture].compact.map{ |e| e.strip }.reject{ |e| e.empty? }

    puts "#{i}. " + "ERROR".ansi(*config.error) + " " + label.ansi(*config.highlight)
    puts
    puts parts.join("\n\n").tabto(4)
    puts

    i += 1
  end

  time, rate, avg = time_tally(entry)

  # total, pass, fail, error, todo, omit = count_tally(entry)

  #total = @passed.size + @failed.size + @raised.size + @skipped.size + @omitted.size
  #total = entry['counts']['total'] || total

  #time = (entry['time'] || (Time.now - @start_time)).to_f
  #avg  = time / total
  #rate = total / time

  puts
  puts "Finished in %.3fs (%.3f test/s, %.6fs avg.)" % [time, rate, avg]
  puts
  puts tally_message(entry)
end
pass(entry) click to toggle source
Calls superclass method Tapout::Reporters::Abstract#pass
# File lib/tapout/reporters/dot_reporter.rb, line 18
def pass(entry)
  $stdout.print '.'.ansi(*config.pass)
  $stdout.flush
  super(entry)
end
start_suite(suite) click to toggle source
Calls superclass method Tapout::Reporters::Abstract#start_suite
# File lib/tapout/reporters/dot_reporter.rb, line 10
def start_suite(suite)
  print "Started"
  print " w/ Seed: #{suite['seed']}" if suite['seed']
  puts
  super(suite)
end