I have created a new rails 3.2 app and my cucumber specs are returning this error -
undefined method `path_to' for #<Cucumber::Rails::World:
When running:
When /^(?:|I )go to (.+)$/ do |page_name|
visit path_to(page_name)
end
My bundler looks like this:
Any idea why ? I thought it was capybara but it is uptodate.
In feature/support/paths.rb
module NavigationHelpers
def path_to(page_name)
case page_name
when /home page/
root_path
else
begin
page_name =~ /the (.*) page/
path_components = $1.split(/\s+/)
self.send(path_components.push('path').join('_').to_sym)
rescue Object => e
raise "can't find mapping from \"#{page_name}\" to a path. \n" + "Now, go and add a mapping in #{__FILE__}"
end
end
end
end
write above code into your paths.rb file
If you want to use path_to method from cucumber-rails-training-wheels gem you should add this file to your support folder: https://github.com/cucumber/cucumber-rails-training-wheels/blob/master/lib/generators/cucumber_rails_training_wheels/install/templates/support/paths.rb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With