Wait for app server to boot on 0.0.0.0 instead of application_address

application_address is used to know where Selenium should navitate to,
but we always are booting app servers on 0.0.0.0 so that's where we
should verify they exist
This commit is contained in:
Bryan Helmkamp 2009-06-16 17:44:42 -04:00
parent 9b5b9fad62
commit 28f19616d6
6 changed files with 39 additions and 3 deletions

View File

@ -1,3 +1,5 @@
require "webrat/selenium/silence_stream"
module Webrat
module Selenium
module ApplicationServers
@ -25,7 +27,7 @@ module Webrat
def wait_for_socket
silence_stream(STDOUT) do
TCPSocket.wait_for_service_with_timeout \
:host => Webrat.configuration.application_address,
:host => "0.0.0.0",
:port => Webrat.configuration.application_port.to_i,
:timeout => 30 # seconds
end

View File

@ -1,3 +1,5 @@
require "webrat/selenium/application_servers/base"
module Webrat
module Selenium
module ApplicationServers

View File

@ -1,3 +1,5 @@
require "webrat/selenium/application_servers/base"
module Webrat
module Selenium
module ApplicationServers

View File

@ -1,3 +1,5 @@
require "webrat/selenium/application_servers/base"
module Webrat
module Selenium
module ApplicationServers

View File

@ -1,3 +1,5 @@
require "webrat/selenium/application_servers/base"
module Webrat
module Selenium
module ApplicationServers

View File

@ -0,0 +1,26 @@
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper")
require "webrat/selenium/application_servers/rails"
RAILS_ROOT = "." unless defined?(RAILS_ROOT)
describe Webrat::Selenium::ApplicationServers::Rails do
include Webrat::Selenium::SilenceStream
before do
@server = Webrat::Selenium::ApplicationServers::Rails.new
# require "rubygems"; require "ruby-debug"; Debugger.start; debugger
@server.stub!(:system)
@server.stub!(:at_exit)
end
describe "boot" do
it "should wait for the server to start on 0.0.0.0" do
TCPSocket.should_receive(:wait_for_service_with_timeout).
with(hash_including(:host => "0.0.0.0"))
silence_stream(STDERR) do
@server.boot
end
end
end
end