class Cucumber::Runtime::BeforeHooks
Public Class Methods
new(hooks, scenario)
click to toggle source
# File lib/cucumber/runtime/before_hooks.rb, line 6 def initialize(hooks, scenario) @hooks = hooks @scenario = scenario end
Public Instance Methods
apply_to(test_case)
click to toggle source
# File lib/cucumber/runtime/before_hooks.rb, line 11 def apply_to(test_case) test_case.with_steps( before_hooks(test_case.source) + test_case.test_steps ) end
Private Instance Methods
before_hooks(source)
click to toggle source
# File lib/cucumber/runtime/before_hooks.rb, line 19 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