When refactoring a sequence of steps to a new, more descriptive step, you can use the steps
method and Ruby's
%-notation
Show archive.org snapshot
like this:
Given 'I have an article in my cart' do
steps %(
When I go the article list
And I open the first article
And I press "Add to cart"
)
end
This way you can simply copy the steps over without any changes.
Warning: Apparently, steps
processes its argument with the Gherkin parser, meaning only lines starting with the Gherkin keywords Given/When/Then/And/But will be considered. In other words, lines not starting with these keywords will be silently ignored!
There is a very similar method step
that takes a single step without Gherkin keyword. It is used like this:
Given 'I have an article in my cart' do
step 'I go the article list'
step 'I open the first article'
step 'I press "Add to cart"'
end
Remember the difference.
Posted by Henning Koch to makandra dev (2012-07-11 13:42)