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.

after_hooks.rb 770 B

2 years ago
12345678910111213141516171819202122232425262728293031
  1. # frozen_string_literal: true
  2. module Cucumber
  3. class Runtime
  4. class AfterHooks
  5. def initialize(id_generator, hooks, scenario, event_bus)
  6. @hooks = hooks
  7. @scenario = scenario
  8. @id_generator = id_generator
  9. @event_bus = event_bus
  10. end
  11. def apply_to(test_case)
  12. test_case.with_steps(
  13. test_case.test_steps + after_hooks.reverse
  14. )
  15. end
  16. private
  17. def after_hooks
  18. @hooks.map do |hook|
  19. action = ->(result) { hook.invoke('After', @scenario.with_result(result)) }
  20. hook_step = Hooks.after_hook(@id_generator.new_id, hook.location, &action)
  21. @event_bus.hook_test_step_created(hook_step, hook)
  22. hook_step
  23. end
  24. end
  25. end
  26. end
  27. end

No Description

Contributors (1)