Sha256: 9191c5f2bca8f531fa1c06a98d8738b45080e500e5da42094730d93e8d33f78c

Contents?: true

Size: 600 Bytes

Versions: 12

Compression:

Stored size: 600 Bytes

Contents

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.source) + test_case.test_steps
        )
      end

      private

      def before_hooks(source)
        @hooks.map do |hook|
          action_block = ->(result) { hook.invoke('Before', @scenario.with_result(result)) }
          Hooks.before_hook(source, hook.location, &action_block)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
cucumber-2.99.0 lib/cucumber/runtime/before_hooks.rb
mobiusloop-0.1.5 lib/cucumber/runtime/before_hooks.rb
cucumber-2.4.0 lib/cucumber/runtime/before_hooks.rb
mobiusloop-0.1.3 lib/cucumber/runtime/before_hooks.rb
mobiusloop-0.1.2 lib/cucumber/runtime/before_hooks.rb
cucumber-2.3.3 lib/cucumber/runtime/before_hooks.rb
cucumber-2.3.2 lib/cucumber/runtime/before_hooks.rb
cucumber-2.3.1 lib/cucumber/runtime/before_hooks.rb
cucumber-2.3.0 lib/cucumber/runtime/before_hooks.rb
cucumber-2.2.0 lib/cucumber/runtime/before_hooks.rb
cucumber-2.1.0 lib/cucumber/runtime/before_hooks.rb
cucumber-2.0.2 lib/cucumber/runtime/before_hooks.rb