Class: ParallelizedSpecs::SlowestSpecLogger

Inherits:
SpecLoggerBase show all
Defined in:
lib/parallelized_specs/slow_spec_logger.rb

Constant Summary

Constants inherited from SpecLoggerBase

ParallelizedSpecs::SpecLoggerBase::RSPEC_1

Instance Method Summary collapse

Methods inherited from SpecLoggerBase

#close, #dump_failure, #dump_failures, #dump_pending, #dump_summary, #initialize, #lock_output

Constructor Details

This class inherits a constructor from ParallelizedSpecs::SpecLoggerBase

Instance Method Details

#determine_spec_duration(spec_start_time) ⇒ Object



22
23
24
25
# File 'lib/parallelized_specs/slow_spec_logger.rb', line 22

def determine_spec_duration(spec_start_time)
  total_time = Time.now - spec_start_time
  total_time
end

#example_failed(example, count, failure) ⇒ Object



17
18
19
20
# File 'lib/parallelized_specs/slow_spec_logger.rb', line 17

def example_failed(example, count, failure)
  total_time = determine_spec_duration(@spec_start_time)
  write_total_spec_time(total_time, example)
end

#example_passed(example) ⇒ Object



12
13
14
15
# File 'lib/parallelized_specs/slow_spec_logger.rb', line 12

def example_passed(example)
  total_time = determine_spec_duration(@spec_start_time)
  write_total_spec_time(total_time, example)
end

#example_started(example) ⇒ Object



8
9
10
# File 'lib/parallelized_specs/slow_spec_logger.rb', line 8

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

#write_total_spec_time(total_time, example) ⇒ Object



27
28
29
30
31
32
# File 'lib/parallelized_specs/slow_spec_logger.rb', line 27

def write_total_spec_time(total_time, example)
  lock_output do
    @output.puts "#{total_time}*#{example.description}*#{example_group.location}"
  end
  @output.flush
end