Class: Cucumber::StepMother::Hook
Instance Method Summary collapse
- #execute_in(world, scenario, location, exception_fails_scenario = true) ⇒ Object
-
#initialize(tag_names, proc) ⇒ Hook
constructor
A new instance of Hook.
- #matches_tag_names?(tag_names) ⇒ Boolean
Constructor Details
#initialize(tag_names, proc) ⇒ Hook
Returns a new instance of Hook.
72 73 74 75 |
# File 'lib/cucumber/step_mother.rb', line 72 def initialize(tag_names, proc) @tag_names = tag_names.map{|tag| Ast::Tags.strip_prefix(tag)} @proc = proc end |
Instance Method Details
#execute_in(world, scenario, location, exception_fails_scenario = true) ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/cucumber/step_mother.rb', line 81 def execute_in(world, scenario, location, exception_fails_scenario = true) begin world.cucumber_instance_exec(false, location, scenario, &@proc) rescue Exception => exception if exception_fails_scenario scenario.fail!(exception) else raise end end end |
#matches_tag_names?(tag_names) ⇒ Boolean
77 78 79 |
# File 'lib/cucumber/step_mother.rb', line 77 def matches_tag_names?(tag_names) @tag_names.empty? || (@tag_names & tag_names).any? end |