Follow up - 518230e6c - Maintenance: Disable VCR for local IP connects

This commit is contained in:
Mantas 2020-09-10 14:20:01 +03:00
parent 6c49446d5a
commit 1b3d2417e2

View file

@ -1,3 +1,6 @@
VCR_IGNORE_MATCHING_HOSTS = %w[zammad.com google.com elasticsearch selenium].freeze
VCR_IGNORE_MATCHING_REGEXPS = [/^192\.168\.\d+\.\d+$/].freeze
VCR.configure do |config|
config.cassette_library_dir = 'test/data/vcr_cassettes'
config.hook_into :webmock
@ -6,9 +9,8 @@ VCR.configure do |config|
config.ignore_request do |request|
uri = URI(request.uri)
['zammad.com', 'google.com', 'elasticsearch', 'selenium', /^192\.168\.\d+\.\d+$/].any? do |site|
site.is_a?(Regexp) ? uri.host.match?(site) : uri.host.include?(site)
end
next true if VCR_IGNORE_MATCHING_HOSTS.any? { |elem| uri.host.include? elem }
next true if VCR_IGNORE_MATCHING_REGEXPS.any? { |elem| uri.host.match? elem }
end
config.register_request_matcher(:oauth_headers) do |r1, r2|