debian-mirror-gitlab/spec/support/webmock.rb

19 lines
492 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2015-09-11 14:41:01 +05:30
require 'webmock'
require 'webmock/rspec'
2019-07-07 11:18:12 +05:30
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
2020-01-01 13:55:28 +05:30
if Gitlab.config.webpack&.dev_server&.enabled
hosts << Gitlab.config.webpack.dev_server.host
end
end.compact.uniq
2019-07-07 11:18:12 +05:30
end
WebMock.disable_net_connect!(allow_localhost: true, allow: webmock_allowed_hosts)