Class: ParallelizedSpecs::SlowestSpecLogger
Constant Summary
ParallelizedSpecs::SpecLoggerBase::RSPEC_1
Instance Method Summary
collapse
#close, #dump_failure, #dump_failures, #dump_pending, #lock_output
Constructor Details
Returns a new instance of SlowestSpecLogger.
6
7
8
9
|
# File 'lib/parallelized_specs/slow_spec_logger.rb', line 6
def initialize(*args)
super
@example_times = {}
end
|
Instance Method Details
#add_total_spec_time(example) ⇒ Object
30
31
32
33
|
# File 'lib/parallelized_specs/slow_spec_logger.rb', line 30
def add_total_spec_time(example)
total_time = Time.now - @spec_start_time
@example_times[total_time] = " file: #{example.location.match(/spec.*rb:\w*/).to_s} spec: #{example.description}"
end
|
#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
23
24
25
26
27
28
|
# File 'lib/parallelized_specs/slow_spec_logger.rb', line 23
def dump_summary(duration, example_count, failure_count, pending_count)
lock_output do
@example_times.sort.map.each { |time, example| @output.write "#{time} #{example}\n" if time.to_f > 10 }
end
@output.flush
end
|
#example_failed(example, count, failure) ⇒ Object
19
20
21
|
# File 'lib/parallelized_specs/slow_spec_logger.rb', line 19
def example_failed(example, count, failure)
add_total_spec_time(example)
end
|
#example_passed(example) ⇒ Object
15
16
17
|
# File 'lib/parallelized_specs/slow_spec_logger.rb', line 15
def example_passed(example)
add_total_spec_time(example)
end
|
#example_started(example) ⇒ Object
11
12
13
|
# File 'lib/parallelized_specs/slow_spec_logger.rb', line 11
def example_started(example)
@spec_start_time = Time.now
end
|