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
|
# File 'lib/parallelized_specs/slow_spec_logger.rb', line 6
def initialize(*args)
@example_times = []
end
|
Instance Method Details
#add_total_spec_time(example) ⇒ Object
28
29
30
31
|
# File 'lib/parallelized_specs/slow_spec_logger.rb', line 28
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
|
#dump_summary(*args) ⇒ Object
22
23
24
25
26
|
# File 'lib/parallelized_specs/slow_spec_logger.rb', line 22
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
|
#example_failed(example, count, failure) ⇒ Object
18
19
20
|
# File 'lib/parallelized_specs/slow_spec_logger.rb', line 18
def example_failed(example, count, failure)
add_total_spec_time(example)
end
|
#example_passed(example) ⇒ Object
14
15
16
|
# File 'lib/parallelized_specs/slow_spec_logger.rb', line 14
def example_passed(example)
add_total_spec_time(example)
end
|
#example_started(example) ⇒ Object
10
11
12
|
# File 'lib/parallelized_specs/slow_spec_logger.rb', line 10
def example_started(example)
@spec_start_time = Time.now
end
|