class Cucumber::Runtime::AfterHooks

Public Class Methods

new(id_generator, hooks, scenario, event_bus) click to toggle source
# File lib/cucumber/runtime/after_hooks.rb, line 5
def initialize(id_generator, hooks, scenario, event_bus)
  @hooks = hooks
  @scenario = scenario
  @id_generator = id_generator
  @event_bus = event_bus
end

Public Instance Methods

apply_to(test_case) click to toggle source
# File lib/cucumber/runtime/after_hooks.rb, line 12
def apply_to(test_case)
  test_case.with_steps(
    test_case.test_steps + after_hooks.reverse
  )
end

Private Instance Methods

after_hooks() click to toggle source
# File lib/cucumber/runtime/after_hooks.rb, line 20
def after_hooks
  @hooks.map do |hook|
    action = ->(result) { hook.invoke('After', @scenario.with_result(result)) }
    hook_step = Hooks.after_hook(@id_generator.new_id, hook.location, &action)
    @event_bus.hook_test_step_created(hook_step, hook)
    hook_step
  end
end