Make sure server does nothing when no app given

This commit is contained in:
Jonas Nicklas 2010-03-12 19:14:10 +01:00
parent 0e6836f548
commit 2b6fd77db5
2 changed files with 7 additions and 0 deletions

View File

@ -55,6 +55,7 @@ class Capybara::Server
end
def boot
return self unless @app
find_available_port
Capybara.log "application has already booted" and return self if responsive?
Capybara.log "booting Rack applicartion on port #{port}"

View File

@ -10,6 +10,12 @@ describe Capybara::Server do
@res.body.should include('Hello Server')
end
it "should do nothing when no server given" do
running do
@server = Capybara::Server.new(nil).boot
end.should_not raise_error
end
it "should find an available port" do
@app1 = proc { |env| [200, {}, "Hello Server!"]}