Sha256: f6a30dce11b40fe5de1a13f6c6f048c74e13ebc09dcd10012bb5431ca564569c

Contents?: true

Size: 597 Bytes

Versions: 3

Compression:

Stored size: 597 Bytes

Contents

# frozen_string_literal: true

require 'cucumber/hooks'

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

      def apply_to(test_case)
        test_case.with_steps(
          before_hooks + test_case.test_steps
        )
      end

      private

      def before_hooks
        @hooks.map do |hook|
          action_block = ->(result) { hook.invoke('Before', @scenario.with_result(result)) }
          Hooks.before_hook(hook.location, &action_block)
        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/before_hooks.rb
cucumber-4.0.0.rc.2 lib/cucumber/runtime/before_hooks.rb
cucumber-4.0.0.rc.1 lib/cucumber/runtime/before_hooks.rb