Sha256: f6c3a5ebd7d053dc2fd584d0364cc935855c89d4bb277d9cec6f2335819c409d

Contents?: true

Size: 596 Bytes

Versions: 4

Compression:

Stored size: 596 Bytes

Contents

# frozen_string_literal: true

module Cucumber
  class Runtime
    class AfterHooks
      def initialize(hooks, scenario)
        @hooks = hooks
        @scenario = scenario
      end

      def apply_to(test_case)
        test_case.with_steps(
          test_case.test_steps + after_hooks(test_case.source).reverse
        )
      end

      private

      def after_hooks(source)
        @hooks.map do |hook|
          action = ->(result) { hook.invoke('After', @scenario.with_result(result)) }
          Hooks.after_hook(source, hook.location, &action)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
cucumber-3.2.0 lib/cucumber/runtime/after_hooks.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/cucumber-3.1.2/lib/cucumber/runtime/after_hooks.rb
cucumber-3.1.2 lib/cucumber/runtime/after_hooks.rb
cucumber-3.1.1 lib/cucumber/runtime/after_hooks.rb