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.



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

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

Instance Method Details

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



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

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

#execute(*args, &continue) ⇒ Object



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

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