Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-28 15:09:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-28 15:09:44 +0300
commitc74b7b5e4345702a1d59c72d923c3580ef157a59 (patch)
tree0d6cc261341fa36babe44e497dc26153da611b7b /spec/support/webmock.rb
parent0f59ad0c29c8679957c716317c842f606177f223 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/webmock.rb')
-rw-r--r--spec/support/webmock.rb18
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!