简体   繁体   中英

Capybara path helpers throwing ActionController::RoutingError: No route matches [GET] “/”

I'm using rspec-rails 2.13.1 and Capybara 1.1.4. Whenever I try to get root_path or get page_path("anything") , the spec throws ActionController::RoutingError:No route matches [GET] "/"

I can run visit 'http://example.dev no problem, but I'd much rather use URL helpers. Any idea why this might not be working?

You can still use named urls in Capybara like

visit root_path

But you can't use get , post in Capybara, which are better for controller tests. Also, they are considered low level in Capybara's integration tests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM