Class: RSpec::MultiprocessRunner::ReportingFormatter
- Inherits:
-
Core::Formatters::DocumentationFormatter
- Object
- Core::Formatters::DocumentationFormatter
- 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(notification) ⇒ Object
- #example_group_finished(example_group) ⇒ Object
- #example_group_started(notification) ⇒ Object
- #example_passed(notification) ⇒ Object
- #example_pending(notification) ⇒ Object
-
#initialize(*ignored_args) ⇒ ReportingFormatter
constructor
A new instance of ReportingFormatter.
- #message(struct) ⇒ Object
Constructor Details
#initialize(*ignored_args) ⇒ ReportingFormatter
Returns a new instance of ReportingFormatter.
29 30 31 32 |
# File 'lib/rspec/multiprocess_runner/reporting_formatter.rb', line 29 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.
26 27 28 |
# File 'lib/rspec/multiprocess_runner/reporting_formatter.rb', line 26 def worker @worker end |
Instance Method Details
#example_failed(notification) ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/rspec/multiprocess_runner/reporting_formatter.rb', line 53 def example_failed(notification) details = capture_output { super(notification) } report_example_result( :failed, notification.example, notification.fully_formatted(1) ) end |
#example_group_finished(example_group) ⇒ Object
40 41 42 |
# File 'lib/rspec/multiprocess_runner/reporting_formatter.rb', line 40 def example_group_finished(example_group) @current_example_groups.pop end |
#example_group_started(notification) ⇒ Object
34 35 36 37 38 |
# File 'lib/rspec/multiprocess_runner/reporting_formatter.rb', line 34 def example_group_started(notification) super(notification) @current_example_groups.push(notification.group.description.strip) end |
#example_passed(notification) ⇒ Object
44 45 46 |
# File 'lib/rspec/multiprocess_runner/reporting_formatter.rb', line 44 def example_passed(notification) report_example_result(:passed, notification.example) end |
#example_pending(notification) ⇒ Object
48 49 50 51 |
# File 'lib/rspec/multiprocess_runner/reporting_formatter.rb', line 48 def example_pending(notification) details = capture_output { super(notification) } report_example_result(:pending, notification.example, details) end |
#message(struct) ⇒ Object
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/rspec/multiprocess_runner/reporting_formatter.rb', line 62 def (struct) # this is just for reporting errors not otherwise reported return unless RSpec.world.non_example_failure = struct. # skip these as they always come after an error is seems return if =~ /^No examples found./ worker.report_error() end |