diff --git a/spec/support/vcr.rb b/spec/support/vcr.rb index f00885449..b3d496990 100644 --- a/spec/support/vcr.rb +++ b/spec/support/vcr.rb @@ -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|