我必须提供步骤
@vcr
Given A
@vcr
Given B
及其定义:
Given /^A$/ do
a_method_that_makes_a_request
end
Given /^B$/ do
a_method_that_makes_a_request
end
这失败了:
Unknown alias: 70305756847740 (Psych::BadAlias)
号码改变了。但是当我这样做时:
# Feature step
Given B
# Step definition
Given /^B$/ do
VCR.use_cassette 'a_cassette' do
a_method_that_makes_a_request
end
end
有效。可以避免此补丁使用@vcr
标记吗?
这是我的配置:
# features/support/vcr_setup.rb
require 'vcr'
VCR.configure do |c|
# c.allow_http_connections_when_no_cassette = true
c.cassette_library_dir = 'spec/fixtures/cassettes'
c.hook_into :webmock
c.ignore_localhost = true
log_path = File.expand_path('../../../log/vcr.log', __FILE__)
c.debug_logger = File.open(log_path, 'w')
end
VCR.cucumber_tags do |t|
t.tag '@localhost_request' # uses default record mode since no options are given
t.tags '@disallowed_1', '@disallowed_2', :record => :none
t.tag '@vcr', :use_scenario_name => true, record: :new_episodes
end