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.



5
6
7
8
# File 'lib/cucumber/core/test/around_hook.rb', line 5

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

Instance Method Details

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



10
11
12
# File 'lib/cucumber/core/test/around_hook.rb', line 10

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

#execute(*args, &continue) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/cucumber/core/test/around_hook.rb', line 14

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