Class: Cucumber::Core::Test::AroundHook

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/core/test/around_hook.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ AroundHook

Returns a new instance of AroundHook.



7
8
9
10
# File 'lib/cucumber/core/test/around_hook.rb', line 7

def initialize(&block)
  @block = block
  @timer = Timer.new
end

Instance Method Details

#describe_to(visitor, *args, &continue) ⇒ Object



12
13
14
# File 'lib/cucumber/core/test/around_hook.rb', line 12

def describe_to(visitor, *args, &continue)
  visitor.around_hook(self, *args, &continue)
end

#execute(*_args, &continue) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/cucumber/core/test/around_hook.rb', line 20

def execute(*_args, &continue)
  @timer.start
  @block.call(continue)
  Result::Unknown.new # Around hook does not know the result of the inner test steps
rescue Result::Raisable => exception
  exception.with_duration(@timer.duration)
rescue Exception => exception
  failed(exception)
end

#hook?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/cucumber/core/test/around_hook.rb', line 16

def hook?
  true
end