在以下測驗中:
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 沒有找到磁帶,并要求我提供一個我根本無法理解的磁帶。
uj5u.com熱心網友回復:
似乎使這項作業的唯一方法是添加以下內容:
setup do
VCR.insert_cassette("path/#{@NAME}", record: :new_episodes)
end
teardown do
VCR.eject_cassette
end
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/376647.html
