首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >水豚::Poltergeist::StatusFailError

水豚::Poltergeist::StatusFailError
EN

Stack Overflow用户
提问于 2016-10-26 19:19:57
回答 1查看 458关注 0票数 1

我的capybara_helper.rb包含以下代码:

代码语言:javascript
复制
Billy.configure do |c|
  c.cache = true
  c.cache_request_headers = false
  c.path_blacklist = []
  c.persist_cache = true
  c.ignore_cache_port = true
  c.non_successful_cache_disabled = false
  c.non_successful_error_level = :warn
  c.non_whitelisted_requests_disabled = false
end

我的测试是:

代码语言:javascript
复制
scenario 'Add new address', driver: :poltergeist_billy do
  proxy.stub("https://maps.googleapis.com/maps/api/js?callback=window.initializeGmaps&key=#{MyApiKeyGoesHere}&libraries=places&language=en").
          and_return(code: 500)
  visit new_address_path

  expect(page).to have_text('Service unavailable')
end

然后我收到一个错误:

代码语言:javascript
复制
Failure/Error: new_address_path

     Capybara::Poltergeist::StatusFailError:
       Request to 'http://127.0.0.1:33173/addresses/new' failed to reach server, check DNS and/or server status - Timed out with the following resources still waiting https://maps.googleapis.com/maps/api/js?callback=window.initializeGmaps&key=#{MyApiKeyGoesHere}-qk&libraries=places

如果要将驱动程序更改为selenium_billy,则错误将为:

代码语言:javascript
复制
Failure/Error: example.run
  Net::ReadTimeout:
    Net::ReadTimeout

谢谢!

EN

回答 1

Stack Overflow用户

发布于 2016-10-27 06:25:18

它挂起的资源url与你在puffing中存根的资源url不完全匹配,你可能想用正则表达式来存根,以确保所有对map的请求都被存根。

代码语言:javascript
复制
 proxy.stub(%r{^https://maps.googleapis.com/maps}).and_return(code: 500)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40260957

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档