切换到远程形式:真正中断VCR

问题描述

我有一个看起来像这样的测试。

RSpec.describe 'Modify visit summary letters',type: :system do
  scenario 'with one correspondence relationship' do
    VCR.use_cassette 'correspondence/faxes/valid_number' do
      # test steps omitted for brevity
    end
  end
end

此测试通常可以通过。但是,当我将某种形式从remote: false更改为remote: true(很明显,我正在更改此内容,没有其他更改)时,测试将停止工作。

remote: true更改之后运行测试时,我得到:

 VCR::Errors::UnhandledHTTPRequestError:                                                                                                                                            
                                                                                                                                                                                         
                                                                                                                                                                                         
        ================================================================================                                                                                                 
        An HTTP request has been made that VCR does not kNow how to handle:                                                                                                              
          POST https://rest.interfax.net/outbound/faxes?faxnumber=%2B15555555555                                                                                                         
                                                                                                                                                                                         
        There is currently no cassette in use.

它说虽然显然有没有使用盒式磁带。

为什么会发生这种情况,我该怎么解决

编辑:这是我的VCR配置。

VCR.configure do |c|
  c.cassette_library_dir = 'spec/cassettes'
  c.hook_into :webmock
  c.ignore_localhost = true
  c.ignore_hosts 'chromedriver.storage.googleapis.com'

  c.default_cassette_options = {
    match_requests_on: [
      :method,VCR.request_matchers.uri_without_param('faxnumber')
    ]
  }
end

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)