Useful Regular Expressions

Original document is found here

Use flexible pluralization

Add a ? immediately following the pluralized word:

Then /^the users? should receive an email$/ do# ...end

The ? specifies that you’re looking for zero or more of the proceeding character. So the above example will capture both user and users.

Use non-capturing groups to help steps read naturally

You can create non-capturing groups by adding a ?: to the beginning of a otherwise normal group (e.g. (?:some text) rather than (some text)). This is treated exactly like a normal group except that the result will is not captured and thus not passed as an argument to your step definition. Here are two common examples:

And /^once the files? (?:have|has) finished processing$/ do
# ...
When /^(?:I|they) create a profile$/ do
# ...



Original Link: ItShouldBeUseful

One of the best ways to do debugging in Cucumber is to pause one every step.

Add a hooks.rb file to the /features/support folder

Add the following code to the hooks.rb file

AfterStep('@pause') do
  print "Press Return to continue..."

Add @pause to the scenario you want to walk through