我安装了vcr和webmock gems。
特征/支持/ vcr_setup.rb:
require 'vcr'
VCR.configure do |c|
c.cassette_library_dir = 'vcr_cassettes'
c.hook_into :webmock
end
特征/ step_definitions / user.rb:
VCR.use_cassette('login to shopify') do
Given /^I am a logged in user$/ do
@shop = create(:shop)
visit root_path
fill_in :shop, :with => @shop.shopify_domain
click_button 'Install'
expect(page).to have_content("We'll automatically")
end
end
当我运行我的套件时,我收到了发出HTTP请求的警报。我错过了哪一步来正确记录第一张录音带,以便我可以重新用于将来的测试?
答案 0 :(得分:0)
尝试指定cassette_library_dir
配置的绝对路径。像这样:
c.cassette_library_dir = Rails.root.join('test', 'fixtures', 'vcr_cassettes')
(无论申请中vcr_cassettes
的正确路径是什么)
所以,你的features/support/vcr_setup.rb
变成了这样:
VCR.configure do |c|
c.cassette_library_dir = Rails.root.join('test', 'fixtures', 'vcr_cassettes')
c.hook_into :webmock
end