Class: SpecForge::Forge::Runner::Reporter
- Inherits:
-
Object
- Object
- SpecForge::Forge::Runner::Reporter
- Defined in:
- lib/spec_forge/forge/runner/reporter.rb
Overview
RSpec formatter listener for tracking test results
Receives notifications from RSpec when examples pass or fail, updating the forge's statistics and display accordingly.
Instance Method Summary collapse
-
#example_failed(notification) ⇒ void
Called when an RSpec example fails.
-
#example_passed(notification) ⇒ void
Called when an RSpec example passes.
-
#initialize(forge = nil) ⇒ Reporter
constructor
Creates a new reporter for the given forge instance.
Constructor Details
#initialize(forge = nil) ⇒ Reporter
Creates a new reporter for the given forge instance
20 21 22 23 24 |
# File 'lib/spec_forge/forge/runner/reporter.rb', line 20 def initialize(forge = nil) @forge = forge @stats = forge&.stats @display = forge&.display end |
Instance Method Details
#example_failed(notification) ⇒ void
This method returns an undefined value.
Called when an RSpec example fails
33 34 35 36 37 38 |
# File 'lib/spec_forge/forge/runner/reporter.rb', line 33 def example_failed(notification) return if @stats.nil? || @display.nil? @stats[:failed] += 1 @display.expectation_failed(notification.example.description, indent: 1) end |
#example_passed(notification) ⇒ void
This method returns an undefined value.
Called when an RSpec example passes
47 48 49 50 51 52 |
# File 'lib/spec_forge/forge/runner/reporter.rb', line 47 def example_passed(notification) return if @stats.nil? || @display.nil? @stats[:passed] += 1 @display.expectation_passed(notification.example.description, indent: 1) end |