Class: ParallelTests::RSpec::FailuresLogger

Inherits:
LoggerBase
  • Object
show all
Defined in:
lib/parallel_tests/rspec/failures_logger.rb

Constant Summary

Constants inherited from LoggerBase

LoggerBase::RSPEC_1, LoggerBase::RSPEC_2, LoggerBase::RSPEC_3

Instance Method Summary collapse

Methods inherited from LoggerBase

#close, #initialize

Constructor Details

This class inherits a constructor from ParallelTests::RSpec::LoggerBase

Instance Method Details

#dump_failure(*args) ⇒ Object



16
17
# File 'lib/parallel_tests/rspec/failures_logger.rb', line 16

def dump_failure(*args)
end

#dump_failures(*args) ⇒ Object



19
20
# File 'lib/parallel_tests/rspec/failures_logger.rb', line 19

def dump_failures(*args)
end

#dump_summary(*args) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/parallel_tests/rspec/failures_logger.rb', line 25

def dump_summary(*args)
  lock_output do
    if RSPEC_1
      dump_commands_to_rerun_failed_examples_rspec_1
    elsif RSPEC_3
      notification = args.first
      unless notification.failed_examples.empty?
        colorizer = ::RSpec::Core::Formatters::ConsoleCodes
        output.puts notification.colorized_rerun_commands(colorizer)
      end
    else
      dump_commands_to_rerun_failed_examples
    end
  end
  @output.flush
end

#example_failed(example, *args) ⇒ Object

RSpec 1: does not keep track of failures, so we do



7
8
9
10
11
12
13
14
# File 'lib/parallel_tests/rspec/failures_logger.rb', line 7

def example_failed(example, *args)
  if RSPEC_1
    @failed_examples ||= []
    @failed_examples << example
  else
    super
  end
end