2016-10-26 6 views
0

私はpoltergeistpuffing-billyの宝石を使用しようとしています。それにいくつか問題があります。私capybara_helper.rbは、次のコードが含まれていますCapybara :: Poltergeist :: StatusFailError

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 

そして、私はエラーが表示されます:

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 

私のテストがある

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にドライバを変更する場合は、そのエラーは次のようになります。

Failure/Error: example.run 
    Net::ReadTimeout: 
    Net::ReadTimeout 

ありがとう!

答えて

0

リソースURLがぶら下がっていて、あなたがpuffing-billyでスタブしているURLと正確に一致しません。代わりに正規表現でスタブして、マップへのすべてのリクエストがスタブになるようにします。

proxy.stub(%r{^https://maps.googleapis.com/maps}).and_return(code: 500) 
+0

私は試してみたところ、「サーバーに到達できませんでした」という同じエラーが表示されました。 – verrom

関連する問題