From 2c51d908301e23a8594eda49f0d64ce197b3e842 Mon Sep 17 00:00:00 2001 From: Kieran Pilkington Date: Sun, 28 Dec 2008 11:39:34 +1300 Subject: [PATCH] adding configuration option to change seleniums environment and port settings --- lib/webrat/core/configuration.rb | 8 ++++++++ lib/webrat/selenium.rb | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/webrat/core/configuration.rb b/lib/webrat/core/configuration.rb index 5344d9f..b0dcfc1 100755 --- a/lib/webrat/core/configuration.rb +++ b/lib/webrat/core/configuration.rb @@ -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: diff --git a/lib/webrat/selenium.rb b/lib/webrat/selenium.rb index 3e8b999..c2cb039 100644 --- a/lib/webrat/selenium.rb +++ b/lib/webrat/selenium.rb @@ -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: