Class: ParallelSpecs::SpecFailuresLogger

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

Instance Method Summary collapse

Methods inherited from SpecLoggerBase

#close, #dump_pending, #dump_summary, #example_passed, #example_pending, #example_started, #lock_output, #start_dump

Constructor Details

#initialize(options, output = nil) ⇒ SpecFailuresLogger

Returns a new instance of SpecFailuresLogger.



5
6
7
8
# File 'lib/parallel_specs/spec_failures_logger.rb', line 5

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

Instance Method Details

#dump_failure(*args) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/parallel_specs/spec_failures_logger.rb', line 14

def dump_failure(*args)
  lock_output do
    @failed_examples.each.with_index do | example, i |
      spec_file = example.location.scan(/^[^:]+/)[0]
      spec_file.gsub!(%r(^.*?/spec/), './spec/')
      @output.puts "#{ParallelSpecs.executable} #{spec_file} -e \"#{example.description}\""
    end
  end
  @output.flush
end

#example_failed(example, count, failure) ⇒ Object



10
11
12
# File 'lib/parallel_specs/spec_failures_logger.rb', line 10

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