Module: Covered::Sus
- Defined in:
- lib/covered/sus.rb
Overview
Integrates coverage tracking with Sus.
Instance Method Summary collapse
-
#after_tests(assertions) ⇒ Object
Finish coverage tracking after tests complete.
-
#covered ⇒ Object
The active coverage configuration.
-
#initialize ⇒ Object
Initialize Sus with optional coverage tracking.
Instance Method Details
#after_tests(assertions) ⇒ Object
Finish coverage tracking after tests complete.
29 30 31 32 33 34 35 36 |
# File 'lib/covered/sus.rb', line 29 def after_tests(assertions) super(assertions) if @covered&.record? @covered.finish @covered.call(self.output.io) end end |
#covered ⇒ Object
The active coverage configuration.
40 41 42 |
# File 'lib/covered/sus.rb', line 40 def covered @covered end |
#initialize ⇒ Object
Initialize Sus with optional coverage tracking. Loads and starts coverage only when the ‘COVERAGE` environment variable is set.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/covered/sus.rb', line 11 def initialize(...) super # Defer loading the coverage configuration unless we are actually running with coverage started 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 |