与Cucumber标签一起使用时VCR BadAlias错误
我必须有步骤与Cucumber标签一起使用时VCR BadAlias错误,cucumber,vcr,Cucumber,Vcr,我必须有步骤 @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
@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