Class: RSpec::MultiprocessRunner::ReportingFormatter
- Inherits:
-
Core::Formatters::BaseTextFormatter
- Object
- Core::Formatters::BaseTextFormatter
- RSpec::MultiprocessRunner::ReportingFormatter
- Defined in:
- lib/rspec/multiprocess_runner/reporting_formatter.rb
Overview
RSpec formatter used by workers to communicate spec execution to the coordinator.
Class Attribute Summary collapse
-
.worker ⇒ Object
The worker to which to report spec status.
Instance Method Summary collapse
- #example_failed(example) ⇒ Object
- #example_group_finished(example_group) ⇒ Object
- #example_group_started(example_group) ⇒ Object
- #example_passed(example) ⇒ Object
- #example_pending(example) ⇒ Object
-
#initialize(*ignored_args) ⇒ ReportingFormatter
constructor
A new instance of ReportingFormatter.
Constructor Details
#initialize(*ignored_args) ⇒ ReportingFormatter
Returns a new instance of ReportingFormatter.
19 20 21 22 |
# File 'lib/rspec/multiprocess_runner/reporting_formatter.rb', line 19 def initialize(*ignored_args) super(StringIO.new) @current_example_groups = [] end |
Class Attribute Details
.worker ⇒ Object
The worker to which to report spec status. This has to be a class-level attribute because you can’t access the formatter instance used by RSpec’s runner.
16 17 18 |
# File 'lib/rspec/multiprocess_runner/reporting_formatter.rb', line 16 def worker @worker end |
Instance Method Details
#example_failed(example) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/rspec/multiprocess_runner/reporting_formatter.rb', line 46 def example_failed(example) super(example) details = capture_output { dump_failure_info(example) dump_backtrace(example) } report_example_result(:failed, example, details) end |
#example_group_finished(example_group) ⇒ Object
30 31 32 |
# File 'lib/rspec/multiprocess_runner/reporting_formatter.rb', line 30 def example_group_finished(example_group) @current_example_groups.pop end |
#example_group_started(example_group) ⇒ Object
24 25 26 27 28 |
# File 'lib/rspec/multiprocess_runner/reporting_formatter.rb', line 24 def example_group_started(example_group) super(example_group) @current_example_groups.push(example_group.description.strip) end |
#example_passed(example) ⇒ Object
34 35 36 37 |
# File 'lib/rspec/multiprocess_runner/reporting_formatter.rb', line 34 def example_passed(example) super(example) report_example_result(:passed, example) end |
#example_pending(example) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/rspec/multiprocess_runner/reporting_formatter.rb', line 39 def example_pending(example) super(example) details = capture_output { dump_pending } pending_examples.clear report_example_result(:pending, example, details) end |