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
32 |
# File 'lib/parallel_specs/rspec/runtime_logger.rb', line 32 def dump_failure(*); end |
#dump_failures ⇒ Object
31 |
# File 'lib/parallel_specs/rspec/runtime_logger.rb', line 31 def dump_failures(*); end |
#dump_pending ⇒ Object
33 |
# File 'lib/parallel_specs/rspec/runtime_logger.rb', line 33 def dump_pending(*); end |
#dump_summary ⇒ Object
30 |
# File 'lib/parallel_specs/rspec/runtime_logger.rb', line 30 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 |
# File 'lib/parallel_specs/rspec/runtime_logger.rb', line 29 def seed(*); end |
#start_dump ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/parallel_specs/rspec/runtime_logger.rb', line 35 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 |