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
Source
# File lib/cucumber/hooks.rb, line 28 def after_hook(id, location, &block) build_hook_step(id, location, block, AfterHook, Core::Test::Action::Unskippable) end
Source
# File lib/cucumber/hooks.rb, line 32 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::Defined) end
Source
# File lib/cucumber/hooks.rb, line 38 def around_hook(&block) Core::Test::AroundHook.new(&block) end
Source
# File lib/cucumber/hooks.rb, line 24 def before_hook(id, location, &block) build_hook_step(id, location, block, BeforeHook, Core::Test::Action::Unskippable) end
Private Class Methods
Source
# File lib/cucumber/hooks.rb, line 44 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