Class: Rutema::Reporters::Summary
- Inherits:
-
BlockReporter
- Object
- BlockReporter
- Rutema::Reporters::Summary
- Defined in:
- lib/rutema/core/reporter.rb
Overview
Produces a summary of the test run returning aggregate numbers for tests and failures
Instance Method Summary collapse
-
#initialize(configuration, dispatcher) ⇒ Summary
constructor
A new instance of Summary.
-
#report(specs, states, errors) ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity.
Constructor Details
#initialize(configuration, dispatcher) ⇒ Summary
Returns a new instance of Summary.
137 138 139 140 |
# File 'lib/rutema/core/reporter.rb', line 137 def initialize(configuration, dispatcher) super @silent = configuration.reporters.fetch(self.class, {})["silent"] end |
Instance Method Details
#report(specs, states, errors) ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity
143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/rutema/core/reporter.rb', line 143 def report(specs, states, errors) failures = [] states.each_value { |v| failures << v.test if v.status == :error } unless @silent count_tests_run = states.reject { |_name, state| state.is_special }.count puts "#{errors.size} errors. #{count_tests_run} test cases executed. #{failures.size} failed" unless failures.empty? puts "Failures:" puts specs.map { |spec| " #{spec.name} - #{spec.filename}" if failures.include?(spec.name) }.compact.join("\n") end end return failures.size + errors.size end |