class Riot::DotMatrixReporter

Outputs in the dot-notion almost everyone should be familiar with, “.” implies pass, “F” implies a failure, and “E” implies an error. If ansi-coloring is available, it is used. Error and failure messages are buffered for output until the end.

Public Class Methods

new(*args) click to toggle source

Creates a new DotMatrixReporter and initializes the failure/error details buffer. @param (see Riot::IOReporter#initialize)

Calls superclass method
# File lib/riot/reporter/dot_matrix.rb, line 9
def initialize(*args)
  super
  @details = []
end

Public Instance Methods

error(description, e) click to toggle source

Prints a “E” and saves the error details (including backtrace) for the end. Prints in red if possible.

@param (see Riot::Reporter#error)

# File lib/riot/reporter/dot_matrix.rb, line 33
def error(description, e)
  print red("E")
  @details << "ERROR - #{test_detail(description, format_error(e))}"
end
fail(description, message, line, file) click to toggle source

Prints a “F” and saves the failure details (including line number and file) for the end. Prints in yellow if possible.

@param (see Riot::Reporter#fail)

# File lib/riot/reporter/dot_matrix.rb, line 25
def fail(description, message, line, file)
  print yellow("F")
  @details << "FAILURE - #{test_detail(description, message)} #{line_info(line, file)}".strip
end
pass(description, message) click to toggle source

Prints a “.”. Prints in green if possible.

@param (see Riot::Reporter#pass)

# File lib/riot/reporter/dot_matrix.rb, line 17
def pass(description, message)
  print green(".")
end
results(time_taken) click to toggle source

(see Riot::Reporter#results)

Calls superclass method
# File lib/riot/reporter/dot_matrix.rb, line 39
def results(time_taken)
  puts "\n#{@details.join("\n\n")}" unless @details.empty?
  super
end

Private Instance Methods

test_detail(description, message) click to toggle source
# File lib/riot/reporter/dot_matrix.rb, line 44
def test_detail(description, message)
  "#{current_context.detailed_description} #{description} => #{message}"
end