class QED::Reporter::Verbatim

Verbose ANSI Console Reporter

Public Instance Methods

after_session(session) click to toggle source
# File lib/qed/reporter/verbatim.rb, line 136
def after_session(session)
  trap 'INFO', 'DEFAULT' if INFO_SIGNAL
  print_time
  print_tally
end
applique(step) click to toggle source
# File lib/qed/reporter/verbatim.rb, line 32
def applique(step)
  io.print "#{@_explain}".ansi(:cyan)
  io.print "#{step.example}" #.ansi(:blue)
end
before_session(session) click to toggle source
# File lib/qed/reporter/verbatim.rb, line 11
def before_session(session)
  @start_time = Time.now

  trap "INFO" do
    print_time
    print_tally
  end if INFO_SIGNAL
end
error(step, error) click to toggle source
Calls superclass method QED::Reporter::Abstract#error
# File lib/qed/reporter/verbatim.rb, line 93
def error(step, error)
  super(step, error)

  raise error if $DEBUG   # TODO: Should this be here?

  tab = step.text.index(/\S/)

  if step.heading?
    if step.code?
      io.print "#{@_explain}".ansi(:bold, :magenta)
    else
      io.print "#{@_explain}".ansi(:bold)
    end
  else
    io.print "#{@_explain}".ansi(:magenta)
  end

  if step.has_example? 
    if step.data?
      io.print "#{step.example}".ansi(:red)
    else
      io.print "#{step.example}".ansi(:red)
    end
  end

  msg = []
  msg << "ERROR: #{error.class} ".ansi(:bold,:red) + error.message #.sub(/for QED::Context.*?$/,'')
  msg << sane_backtrace(error).join("\n").ansi(:bold)
  msg = msg.join("\n") #.ansi(:red)

  io.puts msg.tabto(tab||2)
  io.puts
end
fail(step, error) click to toggle source
Calls superclass method QED::Reporter::Abstract#fail
# File lib/qed/reporter/verbatim.rb, line 60
def fail(step, error)
  super(step, error)

  tab = step.text.index(/\S/)

  if step.heading?
    if step.code?
      io.print "#{@_explain}".ansi(:bold, :magenta)
    else
      io.print "#{@_explain}".ansi(:bold)
    end
  else
    io.print "#{@_explain}".ansi(:magenta)
  end

  if step.has_example? 
    if step.data?
      io.print "#{step.example}".ansi(:red)
    else
      io.print "#{step.example}".ansi(:red)
    end
  end

  msg = []
  msg << "FAIL: ".ansi(:bold, :red) + error.message.to_s #to_str
  msg << sane_backtrace(error).join("\n").ansi(:bold)
  msg = msg.join("\n")

  io.puts msg.tabto(tab||2)
  io.puts
end
match(step, md) click to toggle source
# File lib/qed/reporter/verbatim.rb, line 25
def match(step, md)
  unless md[0].empty?
    @_explain.sub!(md[0], md[0].ansi(:bold))
  end
end
pass(step) click to toggle source
Calls superclass method QED::Reporter::Abstract#pass
# File lib/qed/reporter/verbatim.rb, line 38
def pass(step)
  super(step)
  if step.heading?
    if step.code?
      io.print "#{@_explain}".ansi(:bold, :cyan)
    else
      io.print "#{@_explain}".ansi(:bold)
    end
  else
    io.print "#{@_explain}".ansi(:cyan)
  end

  if step.has_example? 
    if step.data?
      io.print "#{step.example}" #.ansi(:magenta)
    else
      io.print "#{step.example}".ansi(:green)
    end
  end
end
step(step) click to toggle source
# File lib/qed/reporter/verbatim.rb, line 20
def step(step)
  @_explain = step.explain.dup
end