Sha256: ab8057f46d3db5b4a11fa162d6c007fca6822e0ed0576527dacb1b5c9f2c1d73

Contents?: true

Size: 907 Bytes

Versions: 214

Compression:

Stored size: 907 Bytes

Contents

require 'parallelized_specs/spec_logger_base'

class ParallelizedSpecs::SpecRuntimeLogger < ParallelizedSpecs::SpecLoggerBase
  def initialize(*args)
    super
    @example_times = Hash.new(0)
  end

  def example_started(*args)
    @time = Time.now
  end

  def example_passed(example)
    file = example.location.split(':').first
    @example_times[file] += Time.now - @time
  end

  def dump_summary(*args);end
  def dump_failures(*args);end
  def dump_failure(*args);end
  def dump_pending(*args);end

  def start_dump(*args)
    return unless ENV['TEST_ENV_NUMBER'] #only record when running in parallel
    # TODO: Figure out why sometimes time can be less than 0
    lock_output do
      @example_times.each do |file, time|
        relative_path = file.sub(/^#{Regexp.escape Dir.pwd}\//,'')
        @output.puts "#{relative_path}:#{time > 0 ? time : 0}"
      end
    end
    @output.flush
  end
end

Version data entries

214 entries across 214 versions & 1 rubygems

Version Path
parallelized_specs-0.4.84 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.83 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.82 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.81 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.80 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.79 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.78 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.77 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.76 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.75 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.74 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.73 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.72 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.71 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.70 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.69 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.68 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.67 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.66 lib/parallelized_specs/spec_runtime_logger.rb
parallelized_specs-0.4.65 lib/parallelized_specs/spec_runtime_logger.rb