Skip to content
Snippets Groups Projects
Unverified Commit 21f26451 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu :basketball: Committed by Stan Hu
Browse files

Prevent starting multiple Capybara proxy servers

This code is run every time a new Capybara browser session is started.
Running this code multiple times causes subsequent feature specs to slow
down considerably.
parent 921eb47a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -89,11 +89,13 @@
options.add_preference("download.prompt_for_download", false)
end
 
# Set up a proxy server to block all external traffic.
@blackhole_tcp_server = TCPServer.new(0)
Thread.new do
loop do
Thread.start(@blackhole_tcp_server.accept, &:close)
if @blackhole_tcp_server.nil?
# Set up a proxy server to block all external traffic.
@blackhole_tcp_server = TCPServer.new(0)
Thread.new do
loop do
Thread.start(@blackhole_tcp_server.accept, &:close)
end
end
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment