Class: ParallelTests::Gherkin::RuntimeLogger
- Inherits:
-
Object
- Object
- ParallelTests::Gherkin::RuntimeLogger
- Includes:
- Io
- Defined in:
- lib/parallel_tests/gherkin/runtime_logger.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ RuntimeLogger
constructor
A new instance of RuntimeLogger.
Methods included from Io
Constructor Details
#initialize(config) ⇒ RuntimeLogger
Returns a new instance of RuntimeLogger.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/parallel_tests/gherkin/runtime_logger.rb', line 9 def initialize(config) @io = prepare_io(config.out_stream) @example_times = Hash.new(0) config.on_event :test_case_started do |_| @start_at = ParallelTests.now.to_f end config.on_event :test_case_finished do |event| @example_times[event.test_case.location.file] += ParallelTests.now.to_f - @start_at end config.on_event :test_run_finished do |_| lock_output do @io.puts(@example_times.map { |file, time| "#{file}:#{time}" }) end end end |