Class: Cucumber::Distrib::Leader::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/distrib/leader/reporter.rb

Overview

Reporter instance used by Leader to notify reporters. Uses Mutex to prevent race conditions.

Instance Method Summary collapse

Constructor Details

#initialize(runtime) ⇒ Reporter

Returns a new instance of Reporter.

Parameters:

  • runtime (Cucumber::Runtime)


8
9
10
11
12
# File 'lib/cucumber/distrib/leader/reporter.rb', line 8

def initialize(runtime)
  @runtime = runtime
  # Reporters might fail because of race condition.
  @mutex = Mutex.new
end

Instance Method Details

#report_events(events) ⇒ Object

Fire events from workers on Leader for reporters.

Parameters:



24
25
26
27
28
29
30
# File 'lib/cucumber/distrib/leader/reporter.rb', line 24

def report_events(events)
  mutex.synchronize do
    events.each do |e|
      runtime.configuration.event_bus.broadcast(e)
    end
  end
end

#report_retrying_test(test_case_event) ⇒ Object

Send :retrying_test notification.

Parameters:



35
36
37
38
39
40
41
# File 'lib/cucumber/distrib/leader/reporter.rb', line 35

def report_retrying_test(test_case_event)
  return unless test_case_event

  mutex.synchronize do
    runtime.configuration.notify(:retrying_test, test_case_event)
  end
end

#report_test_run_finishedObject

Send :test_run_finished notification.



44
45
46
47
48
# File 'lib/cucumber/distrib/leader/reporter.rb', line 44

def report_test_run_finished
  mutex.synchronize do
    runtime.configuration.notify :test_run_finished
  end
end

#report_test_run_startedObject

Send :test_run_started notification.



15
16
17
18
19
# File 'lib/cucumber/distrib/leader/reporter.rb', line 15

def report_test_run_started
  mutex.synchronize do
    runtime.configuration.notify :test_run_started, []
  end
end