我正在将应用程序的浏览器内测试转换为使用 SitePrism gem。在 gem 自述文件中,我看到以下内容:
A page usually has a URL. If you want to be able to navigate to a page, you'll need to set its URL. Here's how:
class Home < SitePrism::Page
set_url "http://www.google.com"
end
If you've set Capybara's app_host then you can set the URL as follows:
class Home < SitePrism::Page
set_url "/home.htm"
end
我预计需要在多个环境(即本地和临时服务器上)运行这些测试。我想知道如何动态调用 Capybara 的 app_host 方法。我会在我的 spec_helper 文件中添加这样的内容吗?
Capybara.app_host = ENV[URL]
谢谢。