Added application_port_for_selenium to webrat configuration. The use case is when you want to test through a web server sitting in front of your application server.

This commit is contained in:
lukemelia 2010-01-18 09:47:32 -05:00
parent 0387d9eacc
commit d9d9cc1fcc
3 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,7 @@
* Minor enhancements
* Added application_port_for_selenium to webrat configuration. The use case is when you want to test through a web server sitting in front of your application server. (Luke Melia)
== 0.7.0 / 2010-01-17
* Major enhancements

View File

@ -40,6 +40,13 @@ module Webrat
webrat_deprecate :selenium_port, :application_port
webrat_deprecate :selenium_port=, :application_port=
# Which port should selenium use to access the application. Defaults to application_port
attr_writer :application_port_for_selenium
def application_port_for_selenium
@application_port_for_selenium || self.application_port
end
# Which underlying app framework we're testing with selenium
attr_accessor :application_framework
@ -76,7 +83,7 @@ module Webrat
tmp_dir = Pathname.new(Dir.pwd).join("tmp")
self.saved_pages_dir = tmp_dir.exist? ? tmp_dir : Dir.pwd
end
def open_error_files? #:nodoc:
@open_error_files ? true : false
end

View File

@ -232,7 +232,7 @@ EOS
def create_browser
$browser = ::Selenium::Client::Driver.new(Webrat.configuration.selenium_server_address || "localhost",
Webrat.configuration.selenium_server_port, Webrat.configuration.selenium_browser_key, "http://#{Webrat.configuration.application_address}:#{Webrat.configuration.application_port}")
Webrat.configuration.selenium_server_port, Webrat.configuration.selenium_browser_key, "http://#{Webrat.configuration.application_address}:#{Webrat.configuration.application_port_for_selenium}")
$browser.set_speed(0) unless Webrat.configuration.selenium_server_address
at_exit do