Sha256: 298e0fd4bf4248ec286889e524606432871b212779eb382ca5c447b475c71e8c

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

module Riot

  # 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)>'
  #
  class PrettyDotMatrixReporter < DotMatrixReporter

    # Prints a yellow F and formats the Fail messages a bit better
    # than the default DotMatrixReporter
    def fail(description, message, line, file)
      print yellow('F')
      @details << "#{yellow("FAILURE")}\n #{test_detail(description, message)}\n #{line_info(line, file)}".strip
    end

    # Prints out an red E and formats the fail message better
    def error(description, e)
      print red('E')
      @details << "#{red("ERROR")}\n #{test_detail(description,"#{e} occured")}\n #{simple_error(e)}"
    end

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

      format.join("\n")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
riot-0.12.5 lib/riot/reporter/pretty_dot_matrix.rb
riot-0.12.4 lib/riot/reporter/pretty_dot_matrix.rb
riot-0.12.3 lib/riot/reporter/pretty_dot_matrix.rb
riot-0.12.2 lib/riot/reporter/pretty_dot_matrix.rb