Class: ParallelSpecs::RSpec::RuntimeLogger
- Inherits:
-
LoggerBase
- Object
- RSpec::Core::Formatters::BaseTextFormatter
- LoggerBase
- ParallelSpecs::RSpec::RuntimeLogger
- Defined in:
- lib/parallel_specs/rspec/runtime_logger.rb
Instance Method Summary collapse
- #dump_failure ⇒ Object
- #dump_failures ⇒ Object
- #dump_pending ⇒ Object
- #dump_summary ⇒ Object
- #example_group_finished(notification) ⇒ Object
- #example_group_started(example_group) ⇒ Object
-
#initialize(*args) ⇒ RuntimeLogger
constructor
A new instance of RuntimeLogger.
- #seed ⇒ Object
- #start_dump ⇒ Object
Methods inherited from LoggerBase
Constructor Details
#initialize(*args) ⇒ RuntimeLogger
Returns a new instance of RuntimeLogger.
9 10 11 12 13 |
# File 'lib/parallel_specs/rspec/runtime_logger.rb', line 9 def initialize(*args) super @example_times = Hash.new(0) @group_nesting = 0 end |
Instance Method Details
#dump_failure ⇒ Object
38 39 |
# File 'lib/parallel_specs/rspec/runtime_logger.rb', line 38 def dump_failure(*) end |
#dump_failures ⇒ Object
35 36 |
# File 'lib/parallel_specs/rspec/runtime_logger.rb', line 35 def dump_failures(*) end |
#dump_pending ⇒ Object
41 42 |
# File 'lib/parallel_specs/rspec/runtime_logger.rb', line 41 def dump_pending(*) end |
#dump_summary ⇒ Object
32 33 |
# File 'lib/parallel_specs/rspec/runtime_logger.rb', line 32 def dump_summary(*) end |
#example_group_finished(notification) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/parallel_specs/rspec/runtime_logger.rb', line 21 def example_group_finished(notification) @group_nesting -= 1 if @group_nesting.zero? @example_times[notification.group.file_path] += ParallelSpecs.now - @time end super if defined?(super) end |
#example_group_started(example_group) ⇒ Object
15 16 17 18 19 |
# File 'lib/parallel_specs/rspec/runtime_logger.rb', line 15 def example_group_started(example_group) @time = ParallelSpecs.now if @group_nesting.zero? @group_nesting += 1 super end |
#seed ⇒ Object
29 30 |
# File 'lib/parallel_specs/rspec/runtime_logger.rb', line 29 def seed(*) end |
#start_dump ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/parallel_specs/rspec/runtime_logger.rb', line 44 def start_dump(*) return unless ENV["TEST_ENV_NUMBER"] lock_output do @example_times.sort_by(&:last).reverse_each do |file, time| relative_path = file.sub(%r{^#{Regexp.escape(Dir.pwd)}/}, "").sub(%r{^\./}, "") @output.puts "#{relative_path}:#{[time, 0].max}" end end @output.flush end |