2019-07-25 01:27:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-05-21 18:24:46 -04:00
|
|
|
require 'webmock'
|
|
|
|
require 'webmock/rspec'
|
|
|
|
|
2019-02-26 12:50:50 -05:00
|
|
|
def webmock_allowed_hosts
|
|
|
|
%w[elasticsearch registry.gitlab.com-gitlab-org-test-elastic-image].tap do |hosts|
|
|
|
|
if ENV.key?('ELASTIC_URL')
|
|
|
|
hosts << URI.parse(ENV['ELASTIC_URL']).host
|
|
|
|
end
|
2019-11-19 07:06:00 -05:00
|
|
|
|
|
|
|
if Gitlab.config.webpack&.dev_server&.enabled
|
|
|
|
hosts << Gitlab.config.webpack.dev_server.host
|
|
|
|
end
|
|
|
|
end.compact.uniq
|
2019-02-26 12:50:50 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
WebMock.disable_net_connect!(allow_localhost: true, allow: webmock_allowed_hosts)
|