Sha256: cfa37eb9ca539bd08c80403a74192031fef8d981f2231c9757c7302d45c5bf87

Contents?: true

Size: 789 Bytes

Versions: 7

Compression:

Stored size: 789 Bytes

Contents

module Cucumber
  module Core
    module Test
      class AroundHook
        def initialize(&block)
          @block = block
          @timer = Timer.new
        end

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

        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

        private
        def failed(exception)
          Result::Failed.new(@timer.duration, exception)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cucumber-core-1.5.0 lib/cucumber/core/test/around_hook.rb
cucumber-core-1.4.0 lib/cucumber/core/test/around_hook.rb
cucumber-core-1.3.1 lib/cucumber/core/test/around_hook.rb
cucumber-core-1.3.0 lib/cucumber/core/test/around_hook.rb
cucumber-core-1.2.0 lib/cucumber/core/test/around_hook.rb
cucumber-core-1.1.3 lib/cucumber/core/test/around_hook.rb
cucumber-core-1.1.2 lib/cucumber/core/test/around_hook.rb