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(id, location, &block) ⇒ Object



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

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) ⇒ Object

Raises:

  • (ArgumentError)


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

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) ⇒ Object



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

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

.before_hook(id, location, &block) ⇒ Object



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

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