Class: RSpec::Rewind::RunnerLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/rewind/runner_logger.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration:, warn_output:) ⇒ RunnerLogger

Returns a new instance of RunnerLogger.



6
7
8
9
# File 'lib/rspec/rewind/runner_logger.rb', line 6

def initialize(configuration:, warn_output:)
  @configuration = configuration
  @warn_output = warn_output
end

Instance Method Details

#debug(message) ⇒ Object



20
21
22
23
24
# File 'lib/rspec/rewind/runner_logger.rb', line 20

def debug(message)
  return unless @configuration.verbose

  reporter_message("[rspec-rewind] #{message}")
end

#reporter_message(message) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/rspec/rewind/runner_logger.rb', line 11

def reporter_message(message)
  if defined?(::RSpec) && ::RSpec.respond_to?(:configuration)
    reporter = ::RSpec.configuration.reporter
    reporter&.message(message)
  end
rescue StandardError
  @warn_output.call(message)
end