Sha256: f861f4ca4c058892d6127d3037f81eb83b0837c1b32e3610fc3dc1fba94e40bb

Contents?: true

Size: 865 Bytes

Versions: 3

Compression:

Stored size: 865 Bytes

Contents

require 'parallelized_specs/spec_logger_base'

class ParallelizedSpecs::ExampleRerunFailuresLogger < ParallelizedSpecs::SpecLoggerBase

  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.chomp}"
        end
      end
      else
      super
    end
  end

# RSpec 1: dumps 1 failed spec
  def dump_failure(*args)
  end

# RSpec 2: dumps all failed specs
  def dump_failures(*args)
  end

  def dump_summary(*args)
    lock_output do
      if RSPEC_1
        @output.puts "#{@failed_examples.to_s.gsub(/\n/,"")} "
      end
    end
    @output.flush
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
parallelized_specs-0.3.12 lib/parallelized_specs/example_failures_logger.rb
parallelized_specs-0.3.11 lib/parallelized_specs/example_failures_logger.rb
parallelized_specs-0.3.10 lib/parallelized_specs/example_failures_logger.rb