Sha256: 418b177af458a669105f6d815b57cfcd41f3ce9af76550f52d8382d70fd7da24
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
require "teaspoon/formatters/modules/report_module" module Teaspoon module Formatters class DocumentationFormatter < Base include ReportModule protected def initialize(*args) @level = 0 super end def log_suite(result) log_indent_line(result.label, result.level) @level = result.level end def log_passing_spec(result) log_indent_spec(result.label, GREEN) end def log_pending_spec(result) log_indent_spec("#{result.label} (PENDING)", YELLOW) end def log_failing_spec(result) log_indent_spec("#{result.label} (FAILED - #{@failures.length})", RED) end def log_result(result) log_line super end private def log_indent_spec(str, color) log_indent_line(str, level = (@last_suite ? @level + 1 : 0), color) log_intent_stdout(level + 1) end def log_intent_stdout(level) return if @stdout.blank? log_indent_line("# #{@stdout.gsub(/\n$/, '').gsub("\n", "\n# ")}", level, CYAN) end def log_indent_line(str = "", level = nil, color = nil) log_line(indent(str, level || @level), color) end def indent(str = "", level = nil) indent = " " * (level * 2) str.gsub!("\n", "\n#{indent}") "#{indent}#{str}" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
teaspoon-0.9.1 | lib/teaspoon/formatters/documentation_formatter.rb |
teaspoon-0.9.0 | lib/teaspoon/formatters/documentation_formatter.rb |