Skip to content

Commit

Permalink
Added application_port_for_selenium to webrat configuration. The use …
Browse files Browse the repository at this point in the history
…case is when you want to test through a web server sitting in front of your application server.
  • Loading branch information
lukemelia committed Jan 18, 2010
1 parent 0387d9e commit d9d9cc1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions History.txt
@@ -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
Expand Down
9 changes: 8 additions & 1 deletion lib/webrat/core/configuration.rb
Expand Up @@ -40,6 +40,13 @@ class Configuration
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

Expand Down Expand Up @@ -76,7 +83,7 @@ def initialize # :nodoc:
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
Expand Down
2 changes: 1 addition & 1 deletion lib/webrat/selenium/selenium_session.rb
Expand Up @@ -232,7 +232,7 @@ def setup #:nodoc:

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
Expand Down

0 comments on commit d9d9cc1

Please sign in to comment.