class Tapout::Reporters::Markdown

Markdown reporter.

Public Instance Methods

error(entry) click to toggle source
Calls superclass method Tapout::Reporters::Abstract#error
# File lib/tapout/reporters/markdown_reporter.rb, line 63
def error(entry)
  super(entry)

  $stdout.puts "#{mark}" + entry['label'] + "   #{entry['source']}"

  $stdout.puts "\n**MESSAGE**\n\n"
  $stdout.puts entry['exception']['message'].tabto(4)

  $stdout.puts "\n**TYPE**\n\n"
  $stdout.puts entry['exception']['class'].tabto(4)

  #$stdout.puts "    " + ok.caller #clean_backtrace(exception.backtrace)[0..2].join("    \n")

  $stdout.puts "\n**SNIPPET**\n\n"
  $stdout.puts code_snippet(entry['exception'])

  if captured_stdout?(entry)
    $stdout.puts "\n**STDOUT**\n\n"
    $stdout.puts captured_stdout(entry).tabto(4)
  end

  if captured_stderr?(entry)
    $stdout.puts "\n**STDERR**\n\n"
    $stdout.puts captured_stderr(entry).tabto(4)
  end

  $stdout.puts
end
fail(entry) click to toggle source
Calls superclass method Tapout::Reporters::Abstract#fail
# File lib/tapout/reporters/markdown_reporter.rb, line 33
def fail(entry)
  super(entry)

  $stdout.puts "#{mark}" + entry['label'] + "   #{entry['source']}"

  $stdout.puts "\n**MESSAGE**\n\n"
  $stdout.puts entry['exception']['message'].tabto(4)

  $stdout.puts "\n**TYPE**\n\n"
  $stdout.puts entry['exception']['class'].tabto(4)

  #$stdout.puts "    " + ok.caller #clean_backtrace(exception.backtrace)[0]

  $stdout.puts "\n**SNIPPET**\n\n"
  $stdout.puts code_snippet(entry['exception'])

  if captured_stdout?(entry)
    $stdout.puts "\n**STDOUT**\n\n"
    $stdout.puts captured_stdout(entry).tabto(4)
  end

  if captured_stderr?(entry)
    $stdout.puts "\n**STDERR**\n\n"
    $stdout.puts captured_stderr(entry).tabto(4)
  end

  $stdout.puts
end
finish_suite(entry) click to toggle source
# File lib/tapout/reporters/markdown_reporter.rb, line 93
def finish_suite(entry)
  #$stderr.puts
  $stderr.print tally_message(entry)
  $stderr.puts " [%0.4fs] " % [Time.now - @start_time]
end
mark() click to toggle source
# File lib/tapout/reporters/markdown_reporter.rb, line 15
def mark
  ('#' * (@_level + 1)) + ' '
end
pass(entry) click to toggle source
Calls superclass method Tapout::Reporters::Abstract#pass
# File lib/tapout/reporters/markdown_reporter.rb, line 27
def pass(entry)
  super(entry)
  $stdout.puts "#{mark}" + entry['label'] + "   #{entry['source']}"
end
start_case(entry) click to toggle source
# File lib/tapout/reporters/markdown_reporter.rb, line 20
def start_case(entry)
  @_level = entry['level'].to_i + 1
  $stdout.print('#' * @_level + ' ')
  $stdout.puts(entry['label'])
end
start_suite(entry) click to toggle source
# File lib/tapout/reporters/markdown_reporter.rb, line 10
def start_suite(entry)
  @start_time = Time.now
end