VCR在导轨系统测试中未使用盒式磁带



在以下测试中:

require "application_system_test_case"
class ImportTest < ApplicationSystemTestCase
test "importing vacancy succeeds" do
VCR.use_cassette("import_success", record: :all) do
user = users(:role)
sign_in(user)
visit new_externals_path
within "form.form" do
fill_in "External ID", with: "57524"
click_on "Import Vacancy"
end
# TODO: Check that the imported vacancy is displayed
end
end
end

如果我打开调试日志VCR输出以下内容:

[Cassette: 'import_success'] Initialized HTTPInteractionList with request matchers [:method, :uri] and 0 interaction(s): {  }
[webmock] Identified request type (recordable) for [post https://url.com/oauth/idp]
[webmock] Handling request: [post https://url.com/oauth/token] (disabled: false)
[webmock] Identified request type (unhandled) for [post https://url.com/oauth/token]

Rails找不到磁带,要求我提供一个我根本无法理解的磁带。

似乎实现这一点的唯一方法是添加以下内容:

setup do
VCR.insert_cassette("path/#{@NAME}", record: :new_episodes)
end
teardown do
VCR.eject_cassette
end

最新更新