Class: Spec::Runner::Formatter::TackFormatter

Inherits:
BaseFormatter
  • Object
show all
Defined in:
lib/tack/adapters/rspec_adapter.rb

Overview

Stolen from Hydra for now

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ TackFormatter

Returns a new instance of TackFormatter.



25
26
27
28
29
30
31
# File 'lib/tack/adapters/rspec_adapter.rb', line 25

def initialize(options)
  io = StringIO.new # suppress output
  super(options, io)
  @results = { :passed => [],
    :failed => [],
    :pending => []}
end

Instance Attribute Details

#resultsObject

Returns the value of attribute results.



23
24
25
# File 'lib/tack/adapters/rspec_adapter.rb', line 23

def results
  @results
end

Instance Method Details

#example_failed(example, counter, error = nil) ⇒ Object



46
47
48
49
50
51
52
# File 'lib/tack/adapters/rspec_adapter.rb', line 46

def example_failed(example, counter, error=nil)
  @results[:failed] <<
    {
    :description => example.description,
    :failure => build_failure(example, error)
  }
end

#example_passed(example) ⇒ Object



40
41
42
43
44
# File 'lib/tack/adapters/rspec_adapter.rb', line 40

def example_passed(example)
  @results[:passed] << {
    :description => example.description,
  }
end

#example_pending(example) ⇒ Object

Stifle the output of pending examples



34
35
36
37
38
# File 'lib/tack/adapters/rspec_adapter.rb', line 34

def example_pending(example)
  @results[:pending] << {
    :description => example.description,
  }
end