module Cucumber::Hooks
Hooks quack enough like `Cucumber::Core::Ast` source nodes that we can use them as source for test steps
Public Class Methods
after_hook(id, location, &block)
click to toggle source
# File lib/cucumber/hooks.rb, line 15 def after_hook(id, location, &block) build_hook_step(id, location, block, AfterHook, Core::Test::UnskippableAction) end
after_step_hook(id, test_step, location, &block)
click to toggle source
# File lib/cucumber/hooks.rb, line 19 def after_step_hook(id, test_step, location, &block) raise ArgumentError if test_step.hook? build_hook_step(id, location, block, AfterStepHook, Core::Test::Action) end
around_hook(&block)
click to toggle source
# File lib/cucumber/hooks.rb, line 24 def around_hook(&block) Core::Test::AroundHook.new(&block) end
before_hook(id, location, &block)
click to toggle source
# File lib/cucumber/hooks.rb, line 11 def before_hook(id, location, &block) build_hook_step(id, location, block, BeforeHook, Core::Test::UnskippableAction) end
Private Class Methods
build_hook_step(id, location, block, hook_type, action_type)
click to toggle source
# File lib/cucumber/hooks.rb, line 30 def build_hook_step(id, location, block, hook_type, action_type) action = action_type.new(location, &block) hook = hook_type.new(action.location) Core::Test::HookStep.new(id, hook.text, location, action) end