diff --git a/lib/webrat/core/configuration.rb b/lib/webrat/core/configuration.rb index 15be55e..fe7471d 100755 --- a/lib/webrat/core/configuration.rb +++ b/lib/webrat/core/configuration.rb @@ -37,11 +37,22 @@ module Webrat attr_accessor :application_port webrat_deprecate :selenium_port, :application_port + # Which server the application is running on for selenium testing? Defaults to localhost + attr_accessor :application_address + + # Which server Selenium server is running on. Defaults to nil(server starts in webrat process and runs locally) + attr_accessor :selenium_server_address + + # Which server Selenium port is running on. Defaults to 4444 + attr_accessor :selenium_server_port + def initialize # :nodoc: self.open_error_files = true self.parse_with_nokogiri = !Webrat.on_java? self.application_environment = :selenium self.application_port = 3001 + self.application_address = "localhost" + self.selenium_server_port = 4444 end def parse_with_nokogiri? #:nodoc: diff --git a/spec/private/core/configuration_spec.rb b/spec/private/core/configuration_spec.rb index 20900e3..dcc7be2 100755 --- a/spec/private/core/configuration_spec.rb +++ b/spec/private/core/configuration_spec.rb @@ -25,16 +25,6 @@ describe Webrat::Configuration do config.should open_error_files end - it "should use 'selenium' as the application environment by default" do - config = Webrat::Configuration.new - config.application_environment.should == :selenium - end - - it "should use 3001 as the application port by default" do - config = Webrat::Configuration.new - config.application_port.should == 3001 - end - it "should be configurable with a block" do Webrat.configure do |config| config.open_error_files = false @@ -45,11 +35,11 @@ describe Webrat::Configuration do end [:rails, - :selenium, - :rack, - :sinatra, - :merb, - :mechanize].each do |mode| + :selenium, + :rack, + :sinatra, + :merb, + :mechanize].each do |mode| it "should require correct lib when in #{mode} mode" do config = Webrat::Configuration.new config.should_receive(:require).with("webrat/#{mode}") @@ -57,5 +47,30 @@ describe Webrat::Configuration do end end -end + describe "Selenium" do + before :each do + @config = Webrat::Configuration.new + end + it "should use 'selenium' as the application environment by default" do + @config.application_environment.should == :selenium + end + + it "should use 3001 as the application port by default" do + @config.application_port.should == 3001 + end + + it 'should default application address to localhost' do + @config.application_address.should == 'localhost' + end + + it 'should default selenium server address to nil' do + @config.selenium_server_address.should be_nil + end + + it 'should default selenium server port to 4444' do + @config.selenium_server_port.should == 4444 + end + end + +end