Permalink
Browse files

adding configuration option to change seleniums environment and port …

…settings
  • Loading branch information...
Kieran Pilkington
Kieran Pilkington committed Dec 27, 2008
1 parent 362df8a commit 2c51d908301e23a8594eda49f0d64ce197b3e842
Showing with 10 additions and 2 deletions.
  1. +8 −0 lib/webrat/core/configuration.rb
  2. +2 −2 lib/webrat/selenium.rb
@@ -27,9 +27,17 @@ class Configuration
# 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
@@ -26,8 +26,8 @@ def self.stop_selenium_server #:nodoc:
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:

0 comments on commit 2c51d90

Please sign in to comment.