Sha256: 1840a9451e9be2ee6136aee17af4dd2b2609abc059a061ad68e53483faaa0e1a

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 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(
    AWSAccessKeyId SellerId Signature Timestamp StartDate CreatedAfter
    Destination.AttributeList.member.1.Value
  )
  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

2 entries across 2 versions & 1 rubygems

Version Path
peddler-0.7.1 test/integration_helper.rb
peddler-0.7.0 test/integration_helper.rb