Class: ParallelSpecs::SpecSummaryLogger

Inherits:
SpecLoggerBase show all
Defined in:
lib/parallel_specs/spec_summary_logger.rb

Instance Method Summary collapse

Methods inherited from SpecLoggerBase

#close, #dump_pending, #example_started, #lock_output, #start_dump

Constructor Details

#initialize(options, output = nil) ⇒ SpecSummaryLogger

Returns a new instance of SpecSummaryLogger.



5
6
7
8
9
10
# File 'lib/parallel_specs/spec_summary_logger.rb', line 5

def initialize(options, output=nil)
  super
  @passed_examples = []
  @pending_examples = []
  @failed_examples = []
end

Instance Method Details

#dump_failure(*args) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/parallel_specs/spec_summary_logger.rb', line 31

def dump_failure(*args)
  lock_output do
    @output.puts "#{ @failed_examples.size } examples failed:"
    @failed_examples.each.with_index do | failure, i |
      @output.puts "#{ i + 1 })"
      @output.puts failure.header
      @output.puts failure.exception.to_s
      failure.exception.backtrace.each do | caller |
        @output.puts caller
      end
      @output.puts ''
    end
  end
  @output.flush
end

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



24
25
26
27
28
29
# File 'lib/parallel_specs/spec_summary_logger.rb', line 24

def dump_summary(duration, example_count, failure_count, pending_count)
  lock_output do
    @output.puts "#{ @passed_examples.size } examples passed"
  end
  @output.flush
end

#example_failed(example, count, failure) ⇒ Object



20
21
22
# File 'lib/parallel_specs/spec_summary_logger.rb', line 20

def example_failed(example, count, failure)
  @failed_examples << failure
end

#example_passed(example) ⇒ Object



12
13
14
# File 'lib/parallel_specs/spec_summary_logger.rb', line 12

def example_passed(example)
  @passed_examples << example
end

#example_pending(*args) ⇒ Object



16
17
18
# File 'lib/parallel_specs/spec_summary_logger.rb', line 16

def example_pending(*args)
  @pending_examples << args
end