diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /spec/support/webmock.rb | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) | |
download | gitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/support/webmock.rb')
-rw-r--r-- | spec/support/webmock.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/support/webmock.rb b/spec/support/webmock.rb index 57acc3b63b1..f952f7f0985 100644 --- a/spec/support/webmock.rb +++ b/spec/support/webmock.rb @@ -15,4 +15,20 @@ def webmock_allowed_hosts end.compact.uniq end -WebMock.disable_net_connect!(allow_localhost: true, allow: webmock_allowed_hosts) +# This prevents Selenium/WebMock from spawning thousands of connections +# while waiting for an element to appear via Capybara's find: +# https://github.com/teamcapybara/capybara/issues/2322#issuecomment-619321520 +def webmock_enable_with_http_connect_on_start! + webmock_enable!(net_http_connect_on_start: true) +end + +def webmock_enable!(options = {}) + WebMock.disable_net_connect!( + { + allow_localhost: true, + allow: webmock_allowed_hosts + }.merge(options) + ) +end + +webmock_enable! |