Reduce differences in spec/support/webmock.rb

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2019-02-26 18:50:50 +01:00
parent 88d6bdcfec
commit 37b184b339
No known key found for this signature in database
GPG Key ID: 98DFFD1C0C62B70B
1 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,12 @@
require 'webmock'
require 'webmock/rspec'
WebMock.disable_net_connect!(allow_localhost: true)
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)