class ParallelTests::RSpec::VerboseLogger

Public Class Methods

new(output) click to toggle source
Calls superclass method
# File lib/parallel_tests/rspec/verbose_logger.rb, line 17
def initialize(output)
  super
  @line = []
end

Public Instance Methods

example_failed(_failure) click to toggle source
# File lib/parallel_tests/rspec/verbose_logger.rb, line 45
def example_failed(_failure)
  output_formatted_line('FAILED', :failure)
  @line.pop
end
example_group_finished(_notification) click to toggle source
# File lib/parallel_tests/rspec/verbose_logger.rb, line 26
def example_group_finished(_notification)
  @line.pop
end
example_group_started(notification) click to toggle source
# File lib/parallel_tests/rspec/verbose_logger.rb, line 22
def example_group_started(notification)
  @line.push(notification.group.description)
end
example_passed(_passed) click to toggle source
# File lib/parallel_tests/rspec/verbose_logger.rb, line 35
def example_passed(_passed)
  output_formatted_line('PASSED', :success)
  @line.pop
end
example_pending(_pending) click to toggle source
# File lib/parallel_tests/rspec/verbose_logger.rb, line 40
def example_pending(_pending)
  output_formatted_line('PENDING', :pending)
  @line.pop
end
example_started(notification) click to toggle source
# File lib/parallel_tests/rspec/verbose_logger.rb, line 30
def example_started(notification)
  @line.push(notification.example.description)
  output_formatted_line('STARTED', :yellow)
end

Private Instance Methods

output_formatted_line(status, console_code) click to toggle source
# File lib/parallel_tests/rspec/verbose_logger.rb, line 52
def output_formatted_line(status, console_code)
  prefix = ["[#{Process.pid}]"]
  if ENV.include?('TEST_ENV_NUMBER')
    test_env_number = ENV['TEST_ENV_NUMBER'] == '' ? 1 : Integer(ENV['TEST_ENV_NUMBER'])
    prefix << "[#{test_env_number}]"
  end
  prefix << RSpec::Core::Formatters::ConsoleCodes.wrap("[#{status}]", console_code)

  output.puts [*prefix, *@line].join(' ')
end