Module: Covered::Sus

Defined in:
lib/covered/sus.rb

Instance Method Summary collapse

Instance Method Details

#after_tests(assertions) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/covered/sus.rb', line 24

def after_tests(assertions)
  super(assertions)
  
  if @covered&.record?
    @covered.finish
    @covered.call(self.output.io)
  end
end

#coveredObject



33
34
35
# File 'lib/covered/sus.rb', line 33

def covered
  @covered
end

#initializeObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/covered/sus.rb', line 8

def initialize(...)
  super
  
  # Defer loading the coverage configuration unless we are actually running with coverage startd to avoid performance cost/overhead.
  if ENV["COVERAGE"]
    require_relative "config"
    
    @covered = Covered::Config.load(root: self.root)
    if @covered.record?
      @covered.start
    end
  else
    @covered = nil
  end
end