Module: Cucumber::Hooks

Defined in:
lib/cucumber/hooks.rb

Overview

Hooks quack enough like `Cucumber::Core::Ast` source nodes that we can use them as source for test steps

Defined Under Namespace

Classes: AfterHook, AfterStepHook, BeforeHook

Class Method Summary collapse

Class Method Details

.after_hook(location, &block) ⇒ Object


16
17
18
# File 'lib/cucumber/hooks.rb', line 16

def after_hook(location, &block)
  build_hook_step(location, block, AfterHook, Core::Test::UnskippableAction)
end

.after_step_hook(test_step, location, &block) ⇒ Object

Raises:

  • (ArgumentError)

20
21
22
23
# File 'lib/cucumber/hooks.rb', line 20

def after_step_hook(test_step, location, &block)
  raise ArgumentError if test_step.hook?
  build_hook_step(location, block, AfterStepHook, Core::Test::Action)
end

.around_hook(&block) ⇒ Object


25
26
27
# File 'lib/cucumber/hooks.rb', line 25

def around_hook(&block)
  Core::Test::AroundHook.new(&block)
end

.before_hook(location, &block) ⇒ Object


12
13
14
# File 'lib/cucumber/hooks.rb', line 12

def before_hook(location, &block)
  build_hook_step(location, block, BeforeHook, Core::Test::UnskippableAction)
end