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(source, location, &block)
click to toggle source
# File lib/cucumber/hooks.rb, line 16 def after_hook(source, location, &block) build_hook_step(source, location, block, AfterHook, Core::Test::UnskippableAction) end
after_step_hook(source, location, &block)
click to toggle source
# File lib/cucumber/hooks.rb, line 20 def after_step_hook(source, location, &block) raise ArgumentError unless source.last.kind_of?(Core::Ast::Step) build_hook_step(source, location, block, AfterStepHook, Core::Test::Action) end
around_hook(source, &block)
click to toggle source
# File lib/cucumber/hooks.rb, line 25 def around_hook(source, &block) Core::Test::AroundHook.new(&block) end
before_hook(source, location, &block)
click to toggle source
# File lib/cucumber/hooks.rb, line 12 def before_hook(source, location, &block) build_hook_step(source, location, block, BeforeHook, Core::Test::UnskippableAction) end
Private Class Methods
build_hook_step(source, location, block, hook_type, action_type)
click to toggle source
# File lib/cucumber/hooks.rb, line 31 def build_hook_step(source, location, block, hook_type, action_type) action = action_type.new(location, &block) hook = hook_type.new(action.location) Core::Test::Step.new(source + [hook], action) end