Class: TapOut::Reporters::Outline

Inherits:
Abstract
  • Object
show all
Defined in:
lib/tapout/reporters/outline_reporter.rb

Overview

Outline reporter.

TODO: This is still a work in progress.

Constant Summary

Constants inherited from Abstract

Abstract::INTERNALS

Instance Method Summary collapse

Methods inherited from Abstract

#<<, #clean_backtrace, #code_snippet, #complete_cases, #exit_code, #finalize, #finish_case, #finish_test, #handle, inherited, #initialize, #note, #omit, #parse_source_location, #skip, #source, #start_test, #tally, #tally_message

Constructor Details

This class inherits a constructor from TapOut::Reporters::Abstract

Instance Method Details

#error(entry) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/tapout/reporters/outline_reporter.rb', line 40

def error(entry)
  super(entry)

  msg = entry['exception'].values_at('class', 'message').compact.join(' - ')

  $stdout.puts "* " + entry['label'].ansi(:yellow) + "   #{entry['source']}"
  $stdout.puts
  $stdout.puts "    #{msg}"
  #$stdout.puts "    " + ok.caller #clean_backtrace(exception.backtrace)[0..2].join("    \n")
  $stdout.puts
  $stdout.puts code_snippet(entry['exception'])
  $stdout.puts
end

#fail(entry) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/tapout/reporters/outline_reporter.rb', line 26

def fail(entry)
  super(entry)

  msg = entry['exception'].values_at('class', 'message').compact.join(' - ')

  $stdout.puts "* " + entry['label'].ansi(:red) + "   #{entry['source']}"
  $stdout.puts
  $stdout.puts "    #{msg}"
  #$stdout.puts "    " + ok.caller #clean_backtrace(exception.backtrace)[0]
  $stdout.puts
  $stdout.puts code_snippet(entry['exception'])
  $stdout.puts
end

#finish_suite(entry) ⇒ Object



55
56
57
58
59
# File 'lib/tapout/reporters/outline_reporter.rb', line 55

def finish_suite(entry)
  #$stderr.puts
  $stdout.print tally_message(entry)
  $stdout.puts " [%0.4fs] " % [Time.now - @start_time]
end

#pass(entry) ⇒ Object



21
22
23
24
# File 'lib/tapout/reporters/outline_reporter.rb', line 21

def pass(entry)
  super(entry)
  $stdout.puts "* " + entry['label'].ansi(:green) + "   #{entry['source']}"
end

#start_case(entry) ⇒ Object



17
18
19
# File 'lib/tapout/reporters/outline_reporter.rb', line 17

def start_case(entry)
  $stdout.puts entry['label'].ansi(:bold)
end

#start_suite(entry) ⇒ Object



12
13
14
# File 'lib/tapout/reporters/outline_reporter.rb', line 12

def start_suite(entry)
  @start_time = Time.now
end