Last Updated: February 25, 2016
·
600
· orieken

Noncapturing groups in Cucumber:

In this first example we have to put the params "something" in order prevent an error even tho we really don't care what "something"

When /I (visit|go to) the homepage/ do  | something |
  # TODO: code goes here
end

One way to avoid adding an extra param we dont use is to use a noncapturing group

represented by adding ?: before the options

When /I (?:visit|go to) the homepage/ do 
  # TODO: code goes here
end