Sha256: 73818058f7f84f4494528bd6e0c14f8dfa23162e26425ed4a14b18645f89e409

Contents?: true

Size: 675 Bytes

Versions: 3

Compression:

Stored size: 675 Bytes

Contents

require 'peddler/vcr_matcher'
require 'yaml'
require 'vcr'

VCR.configure do |c|
  c.hook_into :excon
  c.cassette_library_dir = 'test/vcr_cassettes'

  c.default_cassette_options = {
    match_requests_on: [::Peddler::VCRMatcher],
    record: ENV['RECORD'] ? :new_episodes : :none
  }

  # c.before_record do |interaction|
  #   code = interaction.response.status.code
  #   interaction.ignore! if code >= 400 && code != 414
  # end
end

module Recorder
  def setup
    ENV['LIVE'] ? VCR.turn_off! : VCR.insert_cassette(test_name)
  end

  def teardown
    VCR.eject_cassette if VCR.turned_on?
  end

  private

  def test_name
    self.class.name.sub('Test', '')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
peddler-1.5.0 test/recorder.rb
peddler-1.4.1 test/recorder.rb
peddler-1.4.0 test/recorder.rb