class ParallelTests::RSpec::RuntimeLogger

Public Class Methods

new(*args) click to toggle source
Calls superclass method ParallelTests::RSpec::LoggerBase::new
# File lib/parallel_tests/rspec/runtime_logger.rb, line 6
def initialize(*args)
  super
  @example_times = Hash.new(0)
  @group_nesting = 0
end

Public Instance Methods

dump_failure(*) click to toggle source
# File lib/parallel_tests/rspec/runtime_logger.rb, line 33
def dump_failure(*); end
dump_failures(*) click to toggle source
# File lib/parallel_tests/rspec/runtime_logger.rb, line 31
def dump_failures(*); end
dump_pending(*) click to toggle source
# File lib/parallel_tests/rspec/runtime_logger.rb, line 35
def dump_pending(*); end
dump_summary(*) click to toggle source
# File lib/parallel_tests/rspec/runtime_logger.rb, line 29
def dump_summary(*); end
example_group_finished(notification) click to toggle source
Calls superclass method
# File lib/parallel_tests/rspec/runtime_logger.rb, line 20
def example_group_finished(notification)
  @group_nesting -= 1
  if @group_nesting == 0
    path = (RSPEC_2 ? notification.file_path : notification.group.file_path)
    @example_times[path] += ParallelTests.now - @time
  end
  super if defined?(super)
end
example_group_started(example_group) click to toggle source
Calls superclass method
# File lib/parallel_tests/rspec/runtime_logger.rb, line 14
def example_group_started(example_group)
  @time = ParallelTests.now if @group_nesting == 0
  @group_nesting += 1
  super
end
start_dump(*) click to toggle source
# File lib/parallel_tests/rspec/runtime_logger.rb, line 37
def start_dump(*)
  return unless ENV['TEST_ENV_NUMBER'] # only record when running in parallel
  lock_output do
    @example_times.each do |file, time|
      relative_path = file.sub(%r{^#{Regexp.escape Dir.pwd}/}, '').sub(%r{^\./}, "")
      @output.puts "#{relative_path}:#{time > 0 ? time : 0}"
    end
  end
  @output.flush
end