If I have a simple cucumber function and a script like this (example code from the cucumber wiki ):
Feature: Eating cucumbers Scenario: eat 5 out of 12 Given there are 12 cucumbers When I eat 5 cucumbers Then I should have 7 cucumbers
I know how to get the function and script name in before :
Before do |scenario| p [scenario.feature.name, scenario.name] end
The above code returns:
["Eating cucumbers", "eat 5 out of 12"]
The problem is that the function has a script scheme:
Scenario Outline: eating Given there are <start> cucumbers When I eat <eat> cucumbers Then I should have <left> cucumbers Examples: | start | eat | left | | 12 | 5 | 7 |
When I run the above code, I get:
undefined method `feature' for #<Cucumber::Ast::OutlineTable::ExampleRow:0x007fb0f94a8240> (NoMethodError)
How do I get the name of the outline of a function and script in a cucumber before hook?
source share