Turn::CueReporter

Cue Reporter

Inspired by Shindo.

Constants

HELP

Public Instance Methods

error(exception, message=nil) click to toggle source
# File lib/turn/reporters/cue_reporter.rb, line 62
def error(exception, message=nil)
  #message = exception.to_s.split("\n")[2..-1].join("\n")
  message = message || exception.to_s
  io.puts("#{ERROR}")
  io.puts(message) #if message

  prompt
end
fail(assertion, message=nil) click to toggle source
# File lib/turn/reporters/cue_reporter.rb, line 47
def fail(assertion, message=nil)
  io.puts(" #{FAIL}")
  #message = assertion.location[0] + "\n" + assertion.message #.gsub("\n","\n")
  message = message || assertion.to_s
  #if message
    message = Colorize.red(message)
    message = message.to_s.tabto(8)
    io.puts(message)
  #end

  show_captured_output

  prompt
end
finish_suite(suite) click to toggle source

def finish_case(kase) end

# File lib/turn/reporters/cue_reporter.rb, line 111
def finish_suite(suite)
  total      = suite.count_tests
  passes     = suite.count_passes
  assertions = suite.count_assertions
  failures   = suite.count_failures
  errors     = suite.count_errors
  skips      = suite.count_skips

  bar = '=' * 78
  # @FIXME: Remove this, since Colorize already take care of colorize?
  if colorize?
    bar = if pass == total then Colorize.green(bar)
          else Colorize.red(bar) end
  end

  # @FIXME: Should we add suite.runtime, instead if this lame time calculations?
  tally = [total, assertions, (Time.new - @time)]

  io.puts bar
  io.puts "  pass: %d,  fail: %d,  error: %d, skip: %d" % [passes, failures, errors, skips]
  io.puts "  total: %d tests with %d assertions in %f seconds" % tally
  io.puts bar
end
finish_test(test) click to toggle source
# File lib/turn/reporters/cue_reporter.rb, line 80
def finish_test(test)
  $stdout = STDOUT
  $stderr = STDERR
end
pass(message=nil) click to toggle source
# File lib/turn/reporters/cue_reporter.rb, line 38
def pass(message=nil)
  io.puts " #{PASS}"
  if message
    message = Colorize.green(message)
    message = message.to_s.tabto(8)
    io.puts(message)
  end
end
show_captured_output() click to toggle source
# File lib/turn/reporters/cue_reporter.rb, line 85
def show_captured_output
  show_captured_stdout
  show_captured_stderr
end
show_captured_stderr() click to toggle source
# File lib/turn/reporters/cue_reporter.rb, line 99
def show_captured_stderr
  @stderr.rewind
  return if @stderr.eof?
  STDOUT.puts(\nSTDERR:#{@stderr.read}.tabto(8))
end
show_captured_stdout() click to toggle source
# File lib/turn/reporters/cue_reporter.rb, line 90
def show_captured_stdout
  @stdout.rewind
  return if @stdout.eof?
  STDOUT.puts(\nSTDOUT:#{@stdout.read}.tabto(8))
end
skip(exception, message=nil) click to toggle source
# File lib/turn/reporters/cue_reporter.rb, line 71
def skip(exception, message=nil)
  message = message || exception.to_s
  io.puts("#{SKIP}")
  io.puts(message) #if message

  #prompt
end
start_case(kase) click to toggle source
# File lib/turn/reporters/cue_reporter.rb, line 21
def start_case(kase)
  io.puts(kase.name)
end
start_suite(suite) click to toggle source
# File lib/turn/reporters/cue_reporter.rb, line 11
def start_suite(suite)
  @suite = suite
  @time  = Time.now
  @stdout = StringIO.new
  @stderr = StringIO.new
  #files = suite.collect{ |s| s.file }.join(' ')
  io.puts "Loaded suite #{suite.name}"
  #io.puts "Started"
end
start_test(test) click to toggle source
# File lib/turn/reporters/cue_reporter.rb, line 25
def start_test(test)
  #if @file != test.file
  #  @file = test.file
  #  io.puts(test.file)
  #end
  name = naturalized_name(test)
  io.print Colorize.blue("    %-69s" % name)
  $stdout = @stdout
  $stderr = @stderr
  $stdout.rewind
  $stderr.rewind
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.