class Tapout::Reporters::Outline

Outline reporter.

TODO: Not sure there is really any good point to this reporter.

Public Instance Methods

case_count(entry) click to toggle source
# File lib/tapout/reporters/outline_reporter.rb, line 33
def case_count(entry)
  level = entry['level'].to_i
  @_case_count = @_case_count[0,level+1]
  @_case_count[level] ||= 0
  @_case_count[level] += 1
  @_case_count.join('.') #+ '.'
  @_case_count[level].to_s
end
error(entry) click to toggle source
Calls superclass method Tapout::Reporters::Abstract#error
# File lib/tapout/reporters/outline_reporter.rb, line 65
def error(entry)
  super(entry)

  printout(entry, 'ERROR', config.error)
end
fail(entry) click to toggle source
Calls superclass method Tapout::Reporters::Abstract#fail
# File lib/tapout/reporters/outline_reporter.rb, line 59
def fail(entry)
  super(entry)

  printout(entry, 'FAIL', config.fail)
end
finish_suite(entry) click to toggle source
# File lib/tapout/reporters/outline_reporter.rb, line 72
def finish_suite(entry)
  time, rate, avg = time_tally(entry)
  delta = duration(time)

  puts
  print tally_message(entry)
  #puts " [%0.4fs %.4ft/s %.4fs/t] " % [time, rate, avg]
  puts " [%s %.2ft/s %.4fs/t] " % [delta, rate, avg]
end
level_tab() click to toggle source
# File lib/tapout/reporters/outline_reporter.rb, line 28
def level_tab
  2 * (@_level + 1)
end
pass(entry) click to toggle source
Calls superclass method Tapout::Reporters::Abstract#pass
# File lib/tapout/reporters/outline_reporter.rb, line 53
def pass(entry)
  super(entry)
  print(' ' * level_tab)
  puts "#{test_count}. " + entry['label'].ansi(:green) + "   #{entry['source']}"
end
start_case(entry) click to toggle source
# File lib/tapout/reporters/outline_reporter.rb, line 18
def start_case(entry)
  @_test_count = 0
  @_level = entry['level'].to_i

  print(' ' * (level_tab - 2))
  puts(case_count(entry) + '. ' + entry['label'].ansi(*config.highlight))
  #puts
end
start_suite(entry) click to toggle source
# File lib/tapout/reporters/outline_reporter.rb, line 12
def start_suite(entry)
  @_case_count = [0]
  @start_time = Time.now
end
start_test(test) click to toggle source
# File lib/tapout/reporters/outline_reporter.rb, line 43
def start_test(test)
  @_test_count += 1
end
test_count() click to toggle source
# File lib/tapout/reporters/outline_reporter.rb, line 48
def test_count
  @_test_count
end

Private Instance Methods

printout(entry, type, ansi) click to toggle source
# File lib/tapout/reporters/outline_reporter.rb, line 85
def printout(entry, type, ansi)
  counter = "#{test_count}. "

  label   = entry['label'].ansi(*ansi)
  message = entry['exception']['message']
  exclass = entry['exception']['class']

  parts = [message, exclass].compact.reject{ |x| x.strip.empty? }

  print(' ' * level_tab)
  puts counter + label + "   #{entry['source']}"
  puts
  puts parts.join("\n\n").tabto(level_tab+counter.size)
  puts
  puts backtrace_snippets(entry).tabto(level_tab++counter.size+4)
  print captured_output(entry).tabto(level_tab+counter.size)
  puts
end