Sha256: ca8ef13e4b1b3f351071e8d7f4b7b7a079f47771459eae12cf91dc86c5b235a2
Contents?: true
Size: 1.93 KB
Versions: 4
Compression:
Stored size: 1.93 KB
Contents
require 'simplecov' require 'coveralls' require 'peddler/test/vcr_matcher' SimpleCov.formatters = [ SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter ] SimpleCov.start do add_filter '/test/' minimum_coverage(99.62) end require 'minitest/autorun' require 'yaml' require 'vcr' begin require 'pry' rescue LoadError # rubocop:disable HandleExceptions end # Wraps MWS credentials to run integration tests against # # Replace entries in the fixture file with real credentials if adding new tests # or otherwise testing against live data. module Accounts extend Enumerable def self.each(&blk) @data.each(&blk) end %w(mws.yml mws.yml.example).each do |path| file = File.expand_path("../#{path}", __FILE__) if File.exist?(file) @data = YAML.load_file(file) break end end end # Sets up clients and bootstraps VCR for integration tests class IntegrationTest < MiniTest::Test def setup ENV['LIVE'] ? VCR.turn_off! : VCR.insert_cassette(api) end def teardown VCR.eject_cassette if VCR.turned_on? end def clients Accounts.map do |account| klass = MWS.const_get("#{api}::Client") klass.new(account) end end private def api self.class.name.sub('Test', '') end end VCR.configure do |c| c.hook_into :excon c.cassette_library_dir = 'test/vcr_cassettes' # HTTP errors are not Peddler's concern, so ignore them to ease development. c.before_record do |interaction| code = interaction.response.status.code interaction.ignore! if code >= 400 && code != 414 end c.default_cassette_options = { match_requests_on: [::Peddler::Test::VCRMatcher], record: !ENV['RECORD'] ? :none : :new_episodes } # So that fixtures do not depend on merchant credentials Accounts.each do |account| c.filter_sensitive_data('MERCHANT_ID') { account['merchant_id'] } c.filter_sensitive_data('AWS_ACCESS_KEY_ID') { account['aws_access_key_id'] } end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
peddler-1.1.1 | test/helper.rb |
peddler-1.1.0 | test/helper.rb |
peddler-1.0.2 | test/helper.rb |
peddler-1.0.1 | test/helper.rb |