Class: RSpec::Multicore::ReporterBridge

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/multicore/reporter_bridge.rb

Overview

Restores parent objects and invokes the real RSpec reporter.

Constant Summary collapse

GROUP_EVENTS =
ReporterProxy::GROUP_EVENTS
EXAMPLE_EVENTS =
ReporterProxy::EXAMPLE_EVENTS

Instance Method Summary collapse

Constructor Details

#initialize(registry, reporter, stdout: $stdout, stderr: $stderr) ⇒ ReporterBridge

Returns a new instance of ReporterBridge.



231
232
233
234
235
236
# File 'lib/rspec/multicore/reporter_bridge.rb', line 231

def initialize(registry, reporter, stdout: $stdout, stderr: $stderr)
  @registry = registry
  @reporter = reporter
  @stdout = stdout
  @stderr = stderr
end

Instance Method Details

#replay(event, payload) ⇒ Object



238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/rspec/multicore/reporter_bridge.rb', line 238

def replay(event, payload)
  case event
  when *GROUP_EVENTS then @reporter.public_send(event, @registry.group(payload))
  when *EXAMPLE_EVENTS then replay_example(event, payload)
  when :message then @reporter.message(payload)
  when :deprecation then @reporter.deprecation(*payload)
  when :notify_non_example_exception then replay_error(payload)
  when :stdout then @stdout.write(payload)
  when :stderr then @stderr.write(payload)
  else raise UnsupportedReporterEvent, "Unsupported RSpec reporter event: #{event}"
  end
end