Class Webrat::Selenium::ApplicationServers::Base

  1. lib/webrat/selenium/application_servers/base.rb (view online)
Parent: Object

Public instance methods

boot ()
[show source]
# File lib/webrat/selenium/application_servers/base.rb, line 7
        def boot
          start
          wait
          stop_at_exit
        end
prepare_pid_file (file_path, pid_file_name)
[show source]
# File lib/webrat/selenium/application_servers/base.rb, line 36
        def prepare_pid_file(file_path, pid_file_name)
          FileUtils.mkdir_p File.expand_path(file_path)
          File.expand_path("#{file_path}/#{pid_file_name}")
        end
stop_at_exit ()
[show source]
# File lib/webrat/selenium/application_servers/base.rb, line 13
        def stop_at_exit
          at_exit do
            stop
          end
        end
wait ()
[show source]
# File lib/webrat/selenium/application_servers/base.rb, line 19
        def wait
          $stderr.print "==> Waiting for #{Webrat.configuration.application_framework} application server on port #{Webrat.configuration.application_port}... "
          wait_for_socket
          $stderr.print "Ready!\n"
        end
wait_for_socket ()
[show source]
# File lib/webrat/selenium/application_servers/base.rb, line 25
        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
          end
          rescue SocketError
          fail
        end