diff options
author | Rémy Coutable <remy@rymai.me> | 2019-02-26 20:50:50 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-03-07 10:13:38 +0300 |
commit | 37b184b3392010515895a1028fe096187a4a6696 (patch) | |
tree | 092a1e86c55be3c7700909cbaa0cb2bda0944470 /spec/support | |
parent | 88d6bdcfec9dfffd083ab1af28aeba3b12c2b171 (diff) |
Reduce differences in spec/support/webmock.rb
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/webmock.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/support/webmock.rb b/spec/support/webmock.rb index af2906b7568..9ac7e7fc515 100644 --- a/spec/support/webmock.rb +++ b/spec/support/webmock.rb @@ -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) |