问题
I have to feature steps
@vcr
Given A
@vcr
Given B
and its definitions:
Given /^A$/ do
a_method_that_makes_a_request
end
Given /^B$/ do
a_method_that_makes_a_request
end
This fail with:
Unknown alias: 70305756847740 (Psych::BadAlias)
The number changes. But when I did this:
# Feature step
Given B
# Step definition
Given /^B$/ do
VCR.use_cassette 'a_cassette' do
a_method_that_makes_a_request
end
end
It works. Can avoid this patch to use @vcr
tag?
This is my config:
# 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
来源:https://stackoverflow.com/questions/14907347/vcr-badalias-error-when-used-with-cucumber-tag