Cucumber's before block
In order to get a step to run before every scenario regardless of whether its specified, use this format:
Given /^(?:no users)$/ do
User.delete_all
end
As you can see in that example, I use this mainly for database setup to ensure constancy.
The key to this is to put everything in a non-capturing group. This then ends up matching everything.
Credit goes to the wonderful email-spec
Written by Sean Todd
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Cucumber
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#