Sha256: 993ab8015b75f65b0b74e1ce32cf06e6d2a0a6d32fde738bb978d73353dee7b6

Contents?: true

Size: 557 Bytes

Versions: 3

Compression:

Stored size: 557 Bytes

Contents

# frozen_string_literal: true

module Cucumber
  class Runtime
    class StepHooks
      def initialize(hooks)
        @hooks = hooks
      end

      def apply(test_steps)
        test_steps.flat_map do |test_step|
          [test_step] + after_step_hooks(test_step)
        end
      end

      private

      def after_step_hooks(test_step)
        @hooks.map do |hook|
          action = ->(*args) { hook.invoke('AfterStep', [args, test_step]) }
          Hooks.after_step_hook(test_step, 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/step_hooks.rb
cucumber-4.0.0.rc.2 lib/cucumber/runtime/step_hooks.rb
cucumber-4.0.0.rc.1 lib/cucumber/runtime/step_hooks.rb