In the following test:
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
If I turn on debug logging VCR outputs the following:
[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 don't find a cassette and ask me to provide one which I simply cannot understand.
CodePudding user response:
It seems the only way to make this work is by adding the following:
setup do
VCR.insert_cassette("path/#{@NAME}", record: :new_episodes)
end
teardown do
VCR.eject_cassette
end