test/helper.rb in peddler-1.2.0 vs test/helper.rb in peddler-1.3.0
- old
+ new
@@ -1,20 +1,20 @@
require 'simplecov'
require 'coveralls'
-require 'peddler/vcr_matcher'
SimpleCov.formatters = [
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start do
add_filter '/test/'
- minimum_coverage(99.62)
end
+require 'dig_rb'
require 'minitest/autorun'
+require 'peddler/vcr_matcher'
require 'yaml'
require 'vcr'
begin
require 'pry'
rescue LoadError # rubocop:disable HandleExceptions
@@ -69,10 +69,12 @@
VCR.configure do |c|
c.hook_into :excon
c.cassette_library_dir = 'test/vcr_cassettes'
+ ::Peddler::VCRMatcher.ignore_seller!
+
# 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
@@ -83,7 +85,14 @@
# 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'] }
+ 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
end
end