Class: Specifier::Formatter::Progress

Inherits:
Base
  • Object
show all
Defined in:
lib/specifier/formatter/progress.rb

Overview

A custom defintion for formatting the specifier results.

Usage:

formatter = Specifier::Formatter::Progress.new
formatter.context(context) do
  formatter.record(example, result)
end
formatter.summarize

Constant Summary collapse

NAME =
'progress'.freeze
PASS =
'+'.freeze
FAIL =
'-'.freeze

Instance Method Summary collapse

Methods inherited from Base

#context, #initialize, #summarize

Constructor Details

This class inherits a constructor from Specifier::Formatter::Base

Instance Method Details

#record(example, result) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/specifier/formatter/progress.rb', line 21

def record(example, result)
  super

  message =
    case result.status
    when :pass then Specifier::Colorizer.passed(PASS)
    when :fail then Specifier::Colorizer.failed(FAIL)
    end

  @logger << message
end