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.
Creates a new DotMatrixReporter and initializes the failure/error details buffer. @param (see Riot::IOReporter#initialize)
# File lib/riot/reporter/dot_matrix.rb, line 9 def initialize(*args) super @details = [] end
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
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
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
(see Riot::Reporter#results)
# File lib/riot/reporter/dot_matrix.rb, line 39 def results(time_taken) puts "\n#{@details.join("\n\n")}" unless @details.empty? super end
# File lib/riot/reporter/dot_matrix.rb, line 44 def test_detail(description, message) "#{current_context.detailed_description} #{description} => #{message}" end