Sha256: 24005426aded8dd75bc0017355e521a6430bef32ff2ee42f87021cfd6e1088b4

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

class DotMatrixReporter < BaseReporter

  def initialize
    super
    self.dots = 0
    self.line_buffer = []
    self.log_messages = []
  end

  defm write(msg)
    if self.dots > 50
      self.writer.writeln(msg)
      self.dots = 0
    else
      self.writer.write(msg)
    end
  end

  defm on_spec_pass(meta, stats)
    self.dots += 1
    self.write('.')
  end

  defm on_spec_failure(meta, err, stats)
    self.dots += 1
    self.write(self.to_red("x"))

    name = meta.get_sentence()
    context = meta.get_context()
    add(self.line_buffer, self.to_red("#{context} ##{name}"))
    add(self.line_buffer, self.to_red("    #{err.get_message()}"))

    self.print_stacktrace(err)

    add(self.line_buffer, '')
  end

  defm on_spec_error(meta, err, stats)
    self.on_spec_failure(meta, err, stats)
  end

  defm write_epilogue_separator
    self.flush_log_buffer()

    self.writer.writeln('')
    for line in self.line_buffer
      self.writer.writeln(line)
    end

    self.writer.writeln("")
  end

  defm write_stacktrace_line(line)
    add(self.line_buffer, "       #{line}")
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
speckle-0.2.0 lib/reporters/dotmatrix_reporter.riml
speckle-0.1.31 lib/reporters/dotmatrix_reporter.riml
speckle-0.1.30 lib/reporters/dotmatrix_reporter.riml
speckle-0.1.29 lib/reporters/dotmatrix_reporter.riml
speckle-0.1.28 lib/reporters/dotmatrix_reporter.riml
speckle-0.1.27 lib/reporters/dotmatrix_reporter.riml