Reputation: 23713
I'm reading the Rails 3 In Action book and they introduce some BDD with Cucumber. I have noticed that the web_steps.rb
file has been deleted Modern Cucumber and Rails. I've added my own web steps regex and that is working as expected. However it seems the file paths.rb
has been removed too. It used to contain a module NavigationHelpers
where you could include code like:
def path_to(page_name)
case page_name
when /the homepage/
root_path
when /the list of articles/
articles_path
else
raise "Can't find mapping from \"#{page_name}\" to a path."
end
end
And then you could do things like:
Given /^(?:|I )am on (.+)$/ do |page_name|
visit path_to(page_name)
end
in your steps.
I've tried adding a file called paths.rb
under features/support
with that module, but I keep getting an undefined path_to method error. So my question is:
How do you deal with this in Cucumber 1.1.4? What's the appropriate way to define this kind of methods/modules?
Upvotes: 1
Views: 1579
Reputation: 2495
Make sure you have
World(NavigationHelpers)
at the bottom of the file. It will make the module methods available in all your step definitions.
Upvotes: 3