You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

step_hooks.rb 765 B

2 years ago
123456789101112131415161718192021222324252627282930
  1. # frozen_string_literal: true
  2. module Cucumber
  3. class Runtime
  4. class StepHooks
  5. def initialize(id_generator, hooks, event_bus)
  6. @hooks = hooks
  7. @id_generator = id_generator
  8. @event_bus = event_bus
  9. end
  10. def apply(test_steps)
  11. test_steps.flat_map do |test_step|
  12. [test_step] + after_step_hooks(test_step)
  13. end
  14. end
  15. private
  16. def after_step_hooks(test_step)
  17. @hooks.map do |hook|
  18. action = ->(*args) { hook.invoke('AfterStep', [args, test_step]) }
  19. hook_step = Hooks.after_step_hook(@id_generator.new_id, test_step, hook.location, &action)
  20. @event_bus.hook_test_step_created(hook_step, hook)
  21. hook_step
  22. end
  23. end
  24. end
  25. end
  26. end

No Description

Contributors (1)