gitlab-org--gitlab-foss/spec/support/webmock.rb
Rémy Coutable 37b184b339
Reduce differences in spec/support/webmock.rb
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-03-07 08:13:38 +01:00

12 lines
341 B
Ruby

require 'webmock'
require 'webmock/rspec'
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
end.uniq
end
WebMock.disable_net_connect!(allow_localhost: true, allow: webmock_allowed_hosts)