Class: WarningsLogger::Spy

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/warnings_logger/spy.rb

Overview

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ Spy

Returns a new instance of Spy.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/warnings_logger/spy.rb', line 23

def initialize(configuration)
  @filesystem = Filesystem.new(configuration)
  @reader = Reader.new(filesystem)
  @partitioner = Partitioner.new(
    configuration: configuration,
    reader: reader
  )
  @reporter = Reporter.new(
    configuration: configuration,
    filesystem: filesystem,
    partitioner: partitioner
  )

  @original_stderr = nil
end

Class Method Details

.call(**options) ⇒ Object

DEPRECATED



7
8
9
10
11
12
13
14
15
# File 'lib/warnings_logger/spy.rb', line 7

def self.call(**options)
  WarningsLogger.configure do |config|
    options.each do |key, value|
      config.public_send("#{key}=", value)
    end
  end

  WarningsLogger.enable
end

.enable(configuration) ⇒ Object



17
18
19
# File 'lib/warnings_logger/spy.rb', line 17

def self.enable(configuration)
  new(configuration).enable
end

Instance Method Details

#enableObject



39
40
41
42
43
# File 'lib/warnings_logger/spy.rb', line 39

def enable
  filesystem.prepare
  capture_warnings
  report_warnings_after_tests_run
end