Sha256: 09fa00b0b73ee300c08dfe7bafc578031cee446366dfad2e01fcfc0a07f995c6

Contents?: true

Size: 1.54 KB

Versions: 2

Compression:

Stored size: 1.54 KB

Contents

$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
require 'vcr'

begin
  require 'ruby-debug'
  Debugger.start
  Debugger.settings[:autoeval] = true if Debugger.respond_to?(:settings)
rescue LoadError
  # ruby-debug wasn't available so neither can the debugging be
end

require 'spec/expectations'

VCR.config do |c|
  c.cache_dir = File.join(File.dirname(__FILE__), '..', 'fixtures', 'vcr_cassettes', RUBY_VERSION)
end

VCR.module_eval do
  def self.completed_cucumber_scenarios
    @completed_cucumber_scenarios ||= []
  end

  class << self
    attr_accessor :current_cucumber_scenario
  end
end

After do |scenario|
  VCR.completed_cucumber_scenarios << scenario
end

Before do |scenario|
  VCR.current_cucumber_scenario = scenario
  temp_dir = File.join(VCR::Config.cache_dir, 'temp')
  FileUtils.rm_rf(temp_dir) if File.exist?(temp_dir)
end

Before('@copy_not_the_real_response_to_temp') do
  orig_file = File.join(VCR::Config.cache_dir, 'not_the_real_response.yml')
  temp_file = File.join(VCR::Config.cache_dir, 'temp', 'not_the_real_response.yml')
  FileUtils.mkdir_p(File.join(VCR::Config.cache_dir, 'temp'))
  FileUtils.cp orig_file, temp_file
end

at_exit do
  %w(record_cassette1 record_cassette2).each do |tag|
    cache_file = File.join(VCR::Config.cache_dir, 'cucumber_tags', "#{tag}.yml")
    FileUtils.rm_rf(cache_file) if File.exist?(cache_file)
  end
end

VCR.cucumber_tags do |t|
  t.tags '@record_cassette1', '@record_cassette2', :record => :unregistered
  t.tags '@replay_cassette1', '@replay_cassette2', '@replay_cassette3', :record => :none
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vcr-0.2.0 features/support/env.rb
vcr-0.1.2 features/support/env.rb