如何在针对app_host运行时使用Capybara设置Poltergeist超时选项?

时间:2014-10-09 22:31:00

标签: rspec capybara phantomjs poltergeist

Capybara.configure do |config|
  config.run_server = false
  config.default_driver = :poltergeist
  config.app_host = 'http://localhost:9292'
end

根据Poltergeist docs的说法,向初步的拓博者提供选项:

options = { timeout:0 }
Capybara.register_driver :poltergeist do |app|
  Capybara::Poltergeist::Driver.new(app, options)
end

所以,我没有应用程序传递给Poltergeist init。如何在没有应用程序的情况下进行设置?

以下 设置选项:

options = { timeout:0 }
Capybara.register_driver :poltergeist do
  Capybara::Poltergeist::Driver.new( options )
end

1 个答案:

答案 0 :(得分:4)

我认为,这应该有效:

Capybara.register_driver :poltergeist do |app|
  Capybara::Poltergeist::Driver.new(app, timeout: 30)
end