Class: FlakeySpecCatcher::EventListener
- Inherits:
-
Object
- Object
- FlakeySpecCatcher::EventListener
- Defined in:
- lib/flakey_spec_catcher/event_listener.rb
Overview
EventListener class
Listens for events from RSpec and processes data from those events.
This event listener will receive example_failed and example_passed events from RSpec and will log those results into the provided result manager
Instance Method Summary collapse
- #example_failed(notification) ⇒ Object
- #example_passed(notification) ⇒ Object
-
#initialize(result_manager) ⇒ EventListener
constructor
A new instance of EventListener.
Constructor Details
#initialize(result_manager) ⇒ EventListener
Returns a new instance of EventListener.
13 14 15 |
# File 'lib/flakey_spec_catcher/event_listener.rb', line 13 def initialize(result_manager) @result_manager = result_manager end |
Instance Method Details
#example_failed(notification) ⇒ Object
17 18 19 20 21 |
# File 'lib/flakey_spec_catcher/event_listener.rb', line 17 def example_failed(notification) description = notification.example.full_description.to_s.strip location = notification.example.location @result_manager.add_result(description, location, (notification)) end |
#example_passed(notification) ⇒ Object
23 24 25 26 27 |
# File 'lib/flakey_spec_catcher/event_listener.rb', line 23 def example_passed(notification) description = notification.example.full_description.to_s.strip location = notification.example.location @result_manager.add_result(description, location) end |