Reputation: 23713
Say I have a feature line like this:
And I fill in "Category" with "soccer"
Even though this particular feature line is associated with a search form, I will need to use the same kind of step when dealing with forms in other features.
Where do you guys place this kind of "shared" steps, or in other words, steps that will be used in different features/scenarios?
I have created a file called shared_steps.rb with this content:
And /^I fill in "([^"]*)" with "([^"]*)"$/ do |field,value|
fill_in field, :with => value
end
Upvotes: 3
Views: 816
Reputation: 11705
I don't see anything wrong with placing this type of step in a 'shared_steps.rb' file, that seems perfectly fine.
I would, however, recommend trying to use steps with more explanatory language, such as 'And I search for "soccer" equipment'. There are well documented reasons that the built-in web_steps.rb file is no longer included with Cucumber.
Upvotes: 2