Sha256: b29e74b13034d3cfa376786c8e6dadd034ef2ddecb67b6dfc5831972c4db379b

Contents?: true

Size: 630 Bytes

Versions: 5

Compression:

Stored size: 630 Bytes

Contents

# frozen_string_literal: true

module Cucumber
  class Runtime
    class StepHooks
      def initialize(id_generator, hooks)
        @hooks = hooks
        @id_generator = id_generator
      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(@id_generator.new_id, test_step, hook.location, &action)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cucumber-4.0.1 lib/cucumber/runtime/step_hooks.rb
cucumber-4.0.0 lib/cucumber/runtime/step_hooks.rb
cucumber-4.0.0.rc.6 lib/cucumber/runtime/step_hooks.rb
cucumber-4.0.0.rc.5 lib/cucumber/runtime/step_hooks.rb
cucumber-4.0.0.rc.4 lib/cucumber/runtime/step_hooks.rb