Class: Cucumber::Distrib::Leader::Reporter
- Inherits:
-
Object
- Object
- Cucumber::Distrib::Leader::Reporter
- 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
-
#initialize(runtime) ⇒ Reporter
constructor
A new instance of Reporter.
-
#report_events(events) ⇒ Object
Fire events from workers on Leader for reporters.
-
#report_retrying_test(test_case_event) ⇒ Object
Send :retrying_test notification.
-
#report_test_run_finished ⇒ Object
Send :test_run_finished notification.
-
#report_test_run_started ⇒ Object
Send :test_run_started notification.
Constructor Details
#initialize(runtime) ⇒ Reporter
Returns a new instance of Reporter.
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.
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.
35 36 37 38 39 40 41 |
# File 'lib/cucumber/distrib/leader/reporter.rb', line 35 def (test_case_event) return unless test_case_event mutex.synchronize do runtime.configuration.notify(:retrying_test, test_case_event) end end |
#report_test_run_finished ⇒ Object
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_started ⇒ Object
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 |