Sha256: dab08af883ecd916fdd3547265baa3fdd2010859c9e77af48ee49d9b82196754

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

require 'credentials'
require 'helper'
require 'recorder'

class IntegrationTest < MiniTest::Test
  include Recorder

  class << self
    def use(endpoint)
      @current_endpoint = endpoint
    end

    def clients
      @clients ||= build_clients
    end

    private

    def build_clients
      klass = MWS.const_get("#{current_endpoint}::Client")
      ::Credentials.map { |credentials| klass.new(credentials) }.shuffle
    end

    def current_endpoint
      @current_endpoint ||= name.sub('Test', '')
    end
  end

  def clients
    self.class.clients
  end
end

::Peddler::VCRMatcher.ignore_seller!

VCR.configure do |c|
  c.before_record do |interaction|
    %w[
      BuyerName BuyerEmail Name AddressLine1 PostalCode Phone Amount
    ].each do |key|
      interaction.response.body.gsub!(/<#{key}>[^<]+</, "<#{key}>FILTERED<")
    end
  end

  Credentials.each do |record|
    c.filter_sensitive_data('MERCHANT_ID') { record['merchant_id'] }
    c.filter_sensitive_data('AWS_ACCESS_KEY_ID') { record['aws_access_key_id'] }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
peddler-2.0.4 test/integration_helper.rb
peddler-2.0.3 test/integration_helper.rb