2

我必须以步骤为特色

@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
4

0 回答 0