1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
Feature: Before Hook
Scenario: Examine names of elements
Given a file named "features/foo.feature" with:
"""
Feature: Feature name
Scenario: Scenario name
Given a step
Scenario Outline: Scenario Outline name
Given a <placeholder>
Examples: Examples Table name
| <placeholder> |
| step |
"""
And a file named "features/support/hook.rb" with:
"""
names = []
Before do |scenario|
unless scenario.respond_to?(:scenario_outline)
names << scenario.feature.name.split("\n").first
names << scenario.name.split("\n").first
else
names << scenario.scenario_outline.feature.name.split("\n").first
names << scenario.scenario_outline.name.split("\n").first
end
if(names.size == 4)
raise "NAMES:\n" + names.join("\n") + "\n"
end
end
"""
When I run `cucumber`
Then the output should contain:
"""
NAMES:
Feature name
Scenario name
Feature name
Scenario Outline name
"""
|