Class: ParallelizedSpecs::ExampleRerunFailuresLogger

Inherits:
SpecLoggerBase show all
Defined in:
lib/parallelized_specs/example_failures_logger.rb

Constant Summary

Constants inherited from SpecLoggerBase

SpecLoggerBase::RSPEC_1

Instance Method Summary collapse

Methods inherited from SpecLoggerBase

#close, #dump_pending, #initialize, #lock_output

Constructor Details

This class inherits a constructor from ParallelizedSpecs::SpecLoggerBase

Instance Method Details

#dump_failure(*args) ⇒ Object

RSpec 1: dumps 1 failed spec



19
20
# File 'lib/parallelized_specs/example_failures_logger.rb', line 19

def dump_failure(*args)
end

#dump_failures(*args) ⇒ Object

RSpec 2: dumps all failed specs



23
24
# File 'lib/parallelized_specs/example_failures_logger.rb', line 23

def dump_failures(*args)
end

#dump_summary(*args) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/parallelized_specs/example_failures_logger.rb', line 26

def dump_summary(*args)
  lock_output do
    if RSPEC_1
      @output.write "#{@failed_examples.to_s}"
    end
  end
  @output.flush
end

#example_failed(example, *args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/parallelized_specs/example_failures_logger.rb', line 5

def example_failed(example, *args)
  if RSPEC_1
    if example.location != nil
      unless !!self.example_group.nested_descriptions.to_s.match(/shared/) || !!self.instance_variable_get(:@example_group).examples.last.location.match(/helper/)
        @failed_examples ||= []
        @failed_examples << "#{example.location.match(/spec.*\d/).to_s} "
      end
    end
    else
    super
  end
end