adding configuration option to change seleniums environment and port settings

This commit is contained in:
Kieran Pilkington 2008-12-28 11:39:34 +13:00
parent 362df8abf0
commit 2c51d90830
2 changed files with 10 additions and 2 deletions

View File

@ -27,9 +27,17 @@ module Webrat
# Save and open pages with error status codes (500-599) in a browser? Defualts to true.
attr_writer :open_error_files
# Which environment should the selenium tests be run in? Defaults to selenium.
attr_accessor :selenium_environment
# Which port should the selenium tests be run on? Defaults to 3001.
attr_accessor :selenium_port
def initialize # :nodoc:
self.open_error_files = true
self.parse_with_nokogiri = !Webrat.on_java?
self.selenium_environment = :selenium
self.selenium_port = 3001
end
def parse_with_nokogiri? #:nodoc:

View File

@ -26,8 +26,8 @@ module Webrat
def self.start_app_server #:nodoc:
pid_file = File.expand_path(RAILS_ROOT + "/tmp/pids/mongrel_selenium.pid")
system("mongrel_rails start -d --chdir=#{RAILS_ROOT} --port=3001 --environment=selenium --pid #{pid_file} &")
TCPSocket.wait_for_service :host => "0.0.0.0", :port => 3001
system("mongrel_rails start -d --chdir=#{RAILS_ROOT} --port=#{Webrat.configuration.selenium_port.to_s} --environment=#{Webrat.configuration.selenium_environment.to_s} --pid #{pid_file} &")
TCPSocket.wait_for_service :host => "0.0.0.0", :port => Webrat.configuration.selenium_port.to_i
end
def self.stop_app_server #:nodoc: