Sha256: 3541dad06639cd43e61c7e2a7201a24e52c4762b037e7d6fa3afda97430ba56b

Contents?: true

Size: 770 Bytes

Versions: 34

Compression:

Stored size: 770 Bytes

Contents

# frozen_string_literal: true

module Cucumber
  class Runtime
    class AfterHooks
      def initialize(id_generator, hooks, scenario, event_bus)
        @hooks = hooks
        @scenario = scenario
        @id_generator = id_generator
        @event_bus = event_bus
      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)) }
          hook_step = Hooks.after_hook(@id_generator.new_id, hook.location, &action)
          @event_bus.hook_test_step_created(hook_step, hook)
          hook_step
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 4 rubygems

Version Path
cucumber-9.2.1 lib/cucumber/runtime/after_hooks.rb
cucumber-9.2.0 lib/cucumber/runtime/after_hooks.rb
cucumber-9.1.2 lib/cucumber/runtime/after_hooks.rb
cucumber-9.1.1 lib/cucumber/runtime/after_hooks.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/cucumber-9.1.0/lib/cucumber/runtime/after_hooks.rb
cucumber-9.1.0 lib/cucumber/runtime/after_hooks.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/cucumber-9.0.2/lib/cucumber/runtime/after_hooks.rb
cucumber-9.0.2 lib/cucumber/runtime/after_hooks.rb
cucumber-9.0.1 lib/cucumber/runtime/after_hooks.rb
cucumber-9.0.0 lib/cucumber/runtime/after_hooks.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime/after_hooks.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime/after_hooks.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime/after_hooks.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime/after_hooks.rb
cucumber-8.0.0 lib/cucumber/runtime/after_hooks.rb
cucumber-8.0.0.rc.1 lib/cucumber/runtime/after_hooks.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/cucumber-7.1.0/lib/cucumber/runtime/after_hooks.rb
cucumber-7.1.0 lib/cucumber/runtime/after_hooks.rb
cucumber-7.0.0 lib/cucumber/runtime/after_hooks.rb
cucumber-6.1.0 lib/cucumber/runtime/after_hooks.rb