I have a step definition, below, that does what I want it to do i.e. it checks the url of the page against the 'page' element of 'PAGES' hash.
Then(/^I should( still)? be at the "(.*)" page$/) do |still, page|
BROWSER.url.should == PAGES[page]
end
The step definition is used for both
However, I don't need "still" to be passed into the block. I just need it to be optional for matching to the step but not passed into the block. How can I do that?
Thanks.
You want to mark the "still" group as non-capturing. This is done by starting the group with ?:
.
Then(/^I should(?: still)? be at the "(.*)" page$/) do |page|
BROWSER.url.should == PAGES[page]
end