Sha256: ff0eccdbe235c7e3e09e41453b4c4fddb812fb1ef5eef42c6ece37c76770d634

Contents?: true

Size: 812 Bytes

Versions: 1

Compression:

Stored size: 812 Bytes

Contents

require 'parallelized_specs'

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

    def example_started(example)
      @example_times||[]
      @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(*args)
      File.open("#{Rails.root}/tmp/parallel_log/slowest_specs.log", 'a+') do |f|
        @example_times.each { | example_details | f.puts "#{example_details}" }
      end
    end

    def add_total_spec_time(example)
      total_time = Time.now - @spec_start_time
      @example_times << "#{total_time}*#{example.description}*#{example_group.location.match(/.*rb/).to_s}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
parallelized_specs-0.4.72 lib/parallelized_specs/slow_spec_logger.rb