Sha256: e455f78fbd3dde08ba85c10c80f48c0d2ad51d10c10ec05db0f5b69062ffaf61

Contents?: true

Size: 562 Bytes

Versions: 3

Compression:

Stored size: 562 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.reverse
        )
      end

      private

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cucumber-4.0.0.rc.3 lib/cucumber/runtime/after_hooks.rb
cucumber-4.0.0.rc.2 lib/cucumber/runtime/after_hooks.rb
cucumber-4.0.0.rc.1 lib/cucumber/runtime/after_hooks.rb