Sha256: 2ebb38bc87b9d8415b20f73a3b8be31e45cdee08445c508fb8ce6f8d2e40ceed

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

require 'yaml'
require 'vcr'

require 'helper'

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

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

  nondeterministic_params = %w(Signature Timestamp StartDate CreatedAfter)
  matcher = VCR.request_matchers.uri_without_param(*nondeterministic_params)
  c.default_cassette_options = {
    match_requests_on: [:method, matcher],
    record: :new_episodes
  }
end

class IntegrationTest < MiniTest::Test
  def api_name
    self.class.name.match(/(.*)Test/)[1]
  end

  def clients
    accounts = begin
      YAML.load_file(File.expand_path('../mws.yml', __FILE__)).shuffle
    rescue Errno::ENOENT
      warn('Skipping integration tests')
      []
    end

    accounts.map do |account|
      MWS.const_get(api_name).new.configure do |c|
        account.each { |k, v| c.send("#{k}=", v) }
      end
    end
  end

  def setup
    VCR.insert_cassette(api_name)
  end

  def teardown
    VCR.eject_cassette
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
peddler-0.7.6 test/integration_helper.rb
peddler-0.7.5 test/integration_helper.rb
peddler-0.7.3 test/integration_helper.rb
peddler-0.7.2 test/integration_helper.rb