Class: Riot::PrettyDotMatrixReporter

Inherits:
DotMatrixReporter show all
Defined in:
lib/riot/reporter/pretty_dot_matrix.rb

Overview

This is essentially just DotMatrix with the legacy DotMatrix formatting, slightly better. Failure and Error outputs are color labeled and are formatted neatly and concisely under each associated label. example: .….…FE.… FAILURE

A failure would have a message like this => expected 1, not 0
(on line 26 in test/core/blah.rb)

ERROR

A reporter asserts this errors => Exception occured
at test/core/report_test.rb:24:in `block (2 levels) in <top (required)>'

Instance Attribute Summary

Attributes inherited from Reporter

#current_context, #errors, #failures, #passes

Instance Method Summary collapse

Methods inherited from DotMatrixReporter

#initialize, #pass, #results

Methods inherited from IOReporter

#filter_backtrace, #format_error, #green, #initialize, #line_info, #plain?, #print, #puts, #red, #results, #with_color, #yellow

Methods inherited from Reporter

#describe_context, #initialize, #new, #pass, #report, #results, #success?, #summarize

Constructor Details

This class inherits a constructor from Riot::DotMatrixReporter

Instance Method Details

#error(description, e) ⇒ Object

Prints out an red E and formats the fail message better



25
26
27
28
# File 'lib/riot/reporter/pretty_dot_matrix.rb', line 25

def error(description, e)
  print red('E')
  @details << "#{red("ERROR")}\n #{test_detail(description,"#{e} occured")}\n #{simple_error(e)}"
end

#fail(description, message, line, file) ⇒ Object

Prints a yellow F and formats the Fail messages a bit better than the default DotMatrixReporter



19
20
21
22
# File 'lib/riot/reporter/pretty_dot_matrix.rb', line 19

def fail(description, message, line, file)
  print yellow('F')
  @details << "#{yellow("FAILURE")}\n #{test_detail(description, message)}\n #{line_info(line, file)}".strip
end

#simple_error(e) ⇒ Object



30
31
32
33
34
# File 'lib/riot/reporter/pretty_dot_matrix.rb', line 30

def simple_error(e)
  format = []
  filter_backtrace(e.backtrace) { |line| format << "at #{line}" }
  format.join("\n")
end