Class: Dox::Formatter

Inherits:
RSpec::Core::Formatters::BaseFormatter
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/dox/formatter.rb

Defined Under Namespace

Classes: CurrentExample

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Formatter

Returns a new instance of Formatter.



11
12
13
14
# File 'lib/dox/formatter.rb', line 11

def initialize(output)
  super
  self.passed_examples = {}
end

Instance Method Details

#dump_summary(summary) ⇒ Object



29
30
31
32
33
34
# File 'lib/dox/formatter.rb', line 29

def dump_summary(summary)
  return if summary.failed_examples.none?

  warn(summary.fully_formatted)
  exit(-1)
end

#example_passed(passed) ⇒ Object



16
17
18
19
# File 'lib/dox/formatter.rb', line 16

def example_passed(passed)
  self.current_example = CurrentExample.new(passed.example)
  move_example_to_passed if current_example.document?
end

#stop(notification) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/dox/formatter.rb', line 21

def stop(notification)
  if notification.failed_examples.any?
    warn(notification.fully_formatted_failed_examples)
  else
    printer.print(passed_examples)
  end
end