Sha256: a68ae875c22005065d194c7c4e75b368bc0ce43713358bfd78f04fb01228d3fa

Contents?: true

Size: 819 Bytes

Versions: 7

Compression:

Stored size: 819 Bytes

Contents

# frozen_string_literal: true
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 & 2 rubygems

Version Path
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/test/around_hook.rb
cucumber-core-3.2.1 lib/cucumber/core/test/around_hook.rb
cucumber-core-3.2.0 lib/cucumber/core/test/around_hook.rb
cucumber-core-3.1.0 lib/cucumber/core/test/around_hook.rb
cucumber-core-3.0.0 lib/cucumber/core/test/around_hook.rb
cucumber-core-3.0.0.pre.2 lib/cucumber/core/test/around_hook.rb
cucumber-core-2.0.0 lib/cucumber/core/test/around_hook.rb