ruby-on-rails - Capybara 测试:VCR::Errors::UnhandledHTTPRequestError:如何解决有关 VCR 的错误?请指导
问题描述
单击“添加新位置”之前触发了一个错误,因为它使用的是 ajax,所以我将 selenium 驱动程序添加到修复了错误的测试中。但是然后单击链接会导致 vcr 错误
Profiles Locations tab shows location data
Failure/Error: visit new_user_session_path
VCR::Errors::UnhandledHTTPRequestError:
An HTTP request has been made that VCR does not know how to handle:
GET http://127.0.0.1:54745/__identify__
为了解决这个错误,我在 VCR 配置中添加了 c.ignore_localhost = true
VCR.configure do |c|
c.cassette_library_dir = 'spec/vcr'
c.hook_into :webmock
c.configure_rspec_metadata!
# c.debug_logger = STDOUT
c.ignore_localhost = true
并将 VCR.use_cassette('your_service_response') 添加到我的位置测试中。然后这导致了另一个错误
An error occurred in a `before(:suite)` hook.
Failure/Error: Requesty::Physical::Request.__elasticsearch__.create_index!
Faraday::ConnectionFailed:
Failed to open TCP connection to localhost:9200 (Connection refused - connect(2) for "localhost" port 9200)
关于我如何解决这个问题的任何建议?
解决方案
推荐阅读
- c++ - cudaMallocManaged() 是否在 RAM 和 VRAM 中创建同步缓冲区?
- python - 如何在没有 ini 和 zip 文件的情况下创建 zip 存档
- c - C素数错误
- python-3.x - Astropy Tables:从另一个表中设置数据类型
- typescript - Nest.Js:从外部项目文件夹导入文件
- corda - Corda 中的调度事件和时间窗口有什么区别
- bash - Bash Yes No 提示再次询问
- python - 是否有从透明到黑色(或任何其他颜色)的 cmap?
- javascript - 如何仅使用 unicode 箭头在 jquery 中切换 div
- python-3.x - Python regex 获取(任何)字符串中的最后一个单词