mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Fixed failing server spec, server needs to be booted
This commit is contained in:
parent
5117a0101b
commit
b4de9b7015
2 changed files with 9 additions and 8 deletions
|
@ -41,7 +41,7 @@ class Capybara::Server
|
|||
|
||||
def boot
|
||||
find_available_port
|
||||
Capybara.log "application has already booted" and return if responsive?
|
||||
Capybara.log "application has already booted" and return self if responsive?
|
||||
Capybara.log "booting Rack applicartion on port #{port}"
|
||||
|
||||
Timeout.timeout(10) do
|
||||
|
@ -61,6 +61,7 @@ class Capybara::Server
|
|||
sleep 0.5
|
||||
end
|
||||
end
|
||||
self
|
||||
rescue Timeout::Error
|
||||
Capybara.log "Rack application timed out during boot"
|
||||
exit
|
||||
|
|
|
@ -4,7 +4,7 @@ describe Capybara::Server do
|
|||
|
||||
it "should spool up a rack server" do
|
||||
@app = proc { |env| [200, {}, "Hello Server!"]}
|
||||
@server = Capybara::Server.new(@app)
|
||||
@server = Capybara::Server.new(@app).boot
|
||||
|
||||
@res = Net::HTTP.start(@server.host, @server.port) { |http| http.get('/') }
|
||||
|
||||
|
@ -15,8 +15,8 @@ describe Capybara::Server do
|
|||
@app1 = proc { |env| [200, {}, "Hello Server!"]}
|
||||
@app2 = proc { |env| [200, {}, "Hello Second Server!"]}
|
||||
|
||||
@server1 = Capybara::Server.new(@app1)
|
||||
@server2 = Capybara::Server.new(@app2)
|
||||
@server1 = Capybara::Server.new(@app1).boot
|
||||
@server2 = Capybara::Server.new(@app2).boot
|
||||
|
||||
@res1 = Net::HTTP.start(@server1.host, @server1.port) { |http| http.get('/') }
|
||||
@res1.body.should include('Hello Server')
|
||||
|
@ -29,10 +29,10 @@ describe Capybara::Server do
|
|||
@app1 = proc { |env| [200, {}, "Hello Server!"]}
|
||||
@app2 = proc { |env| [200, {}, "Hello Second Server!"]}
|
||||
|
||||
@server1a = Capybara::Server.new(@app1)
|
||||
@server1b = Capybara::Server.new(@app1)
|
||||
@server2a = Capybara::Server.new(@app2)
|
||||
@server2b = Capybara::Server.new(@app2)
|
||||
@server1a = Capybara::Server.new(@app1).boot
|
||||
@server1b = Capybara::Server.new(@app1).boot
|
||||
@server2a = Capybara::Server.new(@app2).boot
|
||||
@server2b = Capybara::Server.new(@app2).boot
|
||||
|
||||
@res1 = Net::HTTP.start(@server1b.host, @server1b.port) { |http| http.get('/') }
|
||||
@res1.body.should include('Hello Server')
|
||||
|
|
Loading…
Reference in a new issue