Tag:

rspec路由测试和主机

我看到我可以像这样用rspec测试路由: get(“/”).should route_to(“welcome#index”) 但是我有基于主机名或主机名部分的约束以及几个主机名之间的重定向。 如何在测试时指定主机名? 如何使用正确的配置运行测试? 我试过打印root_url,我得到了: 缺少主机链接! 请提供:host参数,设置default_url_options [:host],或将:only_path设置为true