Capybara trim down the link and getting ActionController::RoutingError:

Capybara trim down the link and getting ActionController::RoutingError:

我在 rails 项目的 ruby 中有一个 link,它将用户重定向到这里:https://blah.com/files/form/anonymous/api/library/142270db-...,但是当 运行 命令

bundle exec rpsec spec/features/*

当我模拟 link 的点击时,我得到:

 ActionController::RoutingError:

没有路由匹配 [GET] "/files/form/anonymous/api/library/142270db-...

为什么 Capybara 会削减 link 然后出现路由错误?

由于您没有提到具体的驱动程序,我假设您使用的是 racktest 驱动程序。它忽略主机名并假定所有 URL 都指向您的应用程序,因为这是它可以访问的所有内容。