Sha256: 8730ededd89a95bf797488c1e4ed55a4ee98950c17797f8313d7cc84e5ff17cb

Contents?: true

Size: 760 Bytes

Versions: 2

Compression:

Stored size: 760 Bytes

Contents

require 'parallelized_specs'

module RSpec
  class ParallelizedSpecs::SlowestSpecLogger < ParallelizedSpecs::SpecLoggerBase

    def initialize
      @examples = []
      super
    end

    def example_started(example)
      @spec_start_time = Time.now
    end

    def example_passed(example)
      add_total_spec_time(example)
    end

    def example_failed(example, count, failure)
      add_total_spec_time(example)
    end

    def dump_summary
      lock_output do
        @examples.each { |example| @output.puts "#{example}" }
      end
      @output.flush
    end

    def add_total_spec_time(example)
      total_time = Time.now - @spec_start_time
      @examples << "#{total_time}*#{example.description}*#{example_group.location}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
parallelized_specs-0.4.67 lib/parallelized_specs/slow_spec_logger.rb
parallelized_specs-0.4.66 lib/parallelized_specs/slow_spec_logger.rb