diff --git a/lib/webrat/selenium/application_servers/base.rb b/lib/webrat/selenium/application_servers/base.rb index 29fda8f..10ecd54 100644 --- a/lib/webrat/selenium/application_servers/base.rb +++ b/lib/webrat/selenium/application_servers/base.rb @@ -1,3 +1,5 @@ +require "webrat/selenium/silence_stream" + module Webrat module Selenium module ApplicationServers @@ -25,9 +27,9 @@ module Webrat def wait_for_socket silence_stream(STDOUT) do TCPSocket.wait_for_service_with_timeout \ - :host => Webrat.configuration.application_address, - :port => Webrat.configuration.application_port.to_i, - :timeout => 30 # seconds + :host => "0.0.0.0", + :port => Webrat.configuration.application_port.to_i, + :timeout => 30 # seconds end rescue SocketError fail diff --git a/lib/webrat/selenium/application_servers/external.rb b/lib/webrat/selenium/application_servers/external.rb index a39bc31..787ef48 100644 --- a/lib/webrat/selenium/application_servers/external.rb +++ b/lib/webrat/selenium/application_servers/external.rb @@ -1,3 +1,5 @@ +require "webrat/selenium/application_servers/base" + module Webrat module Selenium module ApplicationServers diff --git a/lib/webrat/selenium/application_servers/merb.rb b/lib/webrat/selenium/application_servers/merb.rb index fd5d9d8..80312ac 100644 --- a/lib/webrat/selenium/application_servers/merb.rb +++ b/lib/webrat/selenium/application_servers/merb.rb @@ -1,3 +1,5 @@ +require "webrat/selenium/application_servers/base" + module Webrat module Selenium module ApplicationServers diff --git a/lib/webrat/selenium/application_servers/rails.rb b/lib/webrat/selenium/application_servers/rails.rb index 687abef..f202786 100644 --- a/lib/webrat/selenium/application_servers/rails.rb +++ b/lib/webrat/selenium/application_servers/rails.rb @@ -1,3 +1,5 @@ +require "webrat/selenium/application_servers/base" + module Webrat module Selenium module ApplicationServers diff --git a/lib/webrat/selenium/application_servers/sinatra.rb b/lib/webrat/selenium/application_servers/sinatra.rb index dc991a3..6c78495 100644 --- a/lib/webrat/selenium/application_servers/sinatra.rb +++ b/lib/webrat/selenium/application_servers/sinatra.rb @@ -1,3 +1,5 @@ +require "webrat/selenium/application_servers/base" + module Webrat module Selenium module ApplicationServers diff --git a/spec/private/selenium/application_servers/rails_spec.rb b/spec/private/selenium/application_servers/rails_spec.rb new file mode 100644 index 0000000..4c31e1a --- /dev/null +++ b/spec/private/selenium/application_servers/rails_spec.rb @@ -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