Sha256: da1d37e479dfe54eccdf10de90fca4e61a813e900b54c20eab6499fe720fb25c

Contents?: true

Size: 865 Bytes

Versions: 24

Compression:

Stored size: 865 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 hook?
          true
        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

24 entries across 24 versions & 4 rubygems

Version Path
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/cucumber-core-12.0.0/lib/cucumber/core/test/around_hook.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/cucumber-core-11.1.0/lib/cucumber/core/test/around_hook.rb
cucumber-core-12.0.0 lib/cucumber/core/test/around_hook.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/around_hook.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/around_hook.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/around_hook.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/around_hook.rb
cucumber-core-11.1.0 lib/cucumber/core/test/around_hook.rb
cucumber-core-11.0.0 lib/cucumber/core/test/around_hook.rb
cucumber-core-10.1.1 lib/cucumber/core/test/around_hook.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/cucumber-core-10.1.0/lib/cucumber/core/test/around_hook.rb
cucumber-core-10.1.0 lib/cucumber/core/test/around_hook.rb
cucumber-core-10.0.1 lib/cucumber/core/test/around_hook.rb
cucumber-core-10.0.0 lib/cucumber/core/test/around_hook.rb
cucumber-core-9.0.1 lib/cucumber/core/test/around_hook.rb
cucumber-core-9.0.0 lib/cucumber/core/test/around_hook.rb
cucumber-core-8.0.1 lib/cucumber/core/test/around_hook.rb
cucumber-core-7.1.0 lib/cucumber/core/test/around_hook.rb
cucumber-core-7.0.0 lib/cucumber/core/test/around_hook.rb
cucumber-core-6.0.0 lib/cucumber/core/test/around_hook.rb