Class: Mutiny::Integration::RSpec::Hook
- Inherits:
-
Object
- Object
- Mutiny::Integration::RSpec::Hook
- Defined in:
- lib/mutiny/integration/rspec/hook.rb
Instance Attribute Summary collapse
-
#hook ⇒ Object
readonly
Returns the value of attribute hook.
Instance Method Summary collapse
- #example_failed(notification) ⇒ Object
- #example_passed(notification) ⇒ Object
- #example_started(notification) ⇒ Object
-
#initialize(hook) ⇒ Hook
constructor
A new instance of Hook.
- #install(configuration) ⇒ Object
Constructor Details
#initialize(hook) ⇒ Hook
Returns a new instance of Hook.
7 8 9 |
# File 'lib/mutiny/integration/rspec/hook.rb', line 7 def initialize(hook) @hook = hook end |
Instance Attribute Details
#hook ⇒ Object (readonly)
Returns the value of attribute hook.
5 6 7 |
# File 'lib/mutiny/integration/rspec/hook.rb', line 5 def hook @hook end |
Instance Method Details
#example_failed(notification) ⇒ Object
22 23 24 |
# File 'lib/mutiny/integration/rspec/hook.rb', line 22 def example_failed(notification) hook.after(notification.example) end |
#example_passed(notification) ⇒ Object
26 27 28 |
# File 'lib/mutiny/integration/rspec/hook.rb', line 26 def example_passed(notification) hook.after(notification.example) end |
#example_started(notification) ⇒ Object
17 18 19 20 |
# File 'lib/mutiny/integration/rspec/hook.rb', line 17 def example_started(notification) example = notification.example hook.before(example) unless example.pending? || example.skipped? end |
#install(configuration) ⇒ Object
11 12 13 14 15 |
# File 'lib/mutiny/integration/rspec/hook.rb', line 11 def install(configuration) configuration.reporter.register_listener(self, :example_started) configuration.reporter.register_listener(self, :example_failed) configuration.reporter.register_listener(self, :example_passed) end |