1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Failing test

This test will eventually collect a bad port and throw Errno::EADDRINUSE

This problem has been seen in real world testing.
This commit is contained in:
Lukas Oberhuber 2019-09-07 12:05:05 +01:00
parent 64ac389f0e
commit 17717bc261

View file

@ -74,6 +74,21 @@ RSpec.describe Capybara::Server do
end end
end end
def use_port(host, port)
server = TCPServer.new(host, port)
ensure
server&.close
end
it 'should handle that getting available ports fails randomly' do
expect {
100000.times do |count|
port = Capybara::Server.new(Object.new).send(:find_available_port, "0.0.0.0")
use_port("0.0.0.0", port)
end
}.not_to raise_error
end
it 'should return its #base_url' do it 'should return its #base_url' do
app = proc { |_env| [200, {}, ['Hello Server!']] } app = proc { |_env| [200, {}, ['Hello Server!']] }
server = described_class.new(app).boot server = described_class.new(app).boot