Class: MatrixFormatter::Formatters::BaseFormatter

Inherits:
RSpec::Core::Formatters::BaseFormatter
  • Object
show all
Defined in:
lib/matrix_formatter/formatters/base_formatter.rb

Direct Known Subclasses

MarkdownFormatter, TextFormatter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ BaseFormatter

Returns a new instance of BaseFormatter.



8
9
10
11
# File 'lib/matrix_formatter/formatters/base_formatter.rb', line 8

def initialize(output)
  super(output)
  @matrix = matrix
end

Instance Attribute Details

#matrixObject

Returns the value of attribute matrix.



6
7
8
# File 'lib/matrix_formatter/formatters/base_formatter.rb', line 6

def matrix
  @matrix
end

Instance Method Details

#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object



42
43
44
# File 'lib/matrix_formatter/formatters/base_formatter.rb', line 42

def dump_summary(duration, example_count, failure_count, pending_count)
  # don't
end

#example_failed(example) ⇒ Object



34
35
36
# File 'lib/matrix_formatter/formatters/base_formatter.rb', line 34

def example_failed(example)
  @matrix.add_result :failed
end

#example_group_started(example_group) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/matrix_formatter/formatters/base_formatter.rb', line 17

def example_group_started(example_group)
  description = example_group.description
  if @matrix.implementors.include? description
    @matrix.current_implementor = description
  else
    @matrix.current_product = description
  end
end

#example_passed(example) ⇒ Object



30
31
32
# File 'lib/matrix_formatter/formatters/base_formatter.rb', line 30

def example_passed(example)
  @matrix.add_result :passed
end

#example_pending(example) ⇒ Object



38
39
40
# File 'lib/matrix_formatter/formatters/base_formatter.rb', line 38

def example_pending(example)
  @matrix.add_result :pending
end

#example_started(example) ⇒ Object



26
27
28
# File 'lib/matrix_formatter/formatters/base_formatter.rb', line 26

def example_started(example)
  @matrix.current_feature = example.description
end

#start(expected_example_count) ⇒ Object



13
14
15
# File 'lib/matrix_formatter/formatters/base_formatter.rb', line 13

def start(expected_example_count)
  @matrix ||= MatrixFormatter::FeatureMatrix.new
end