Skip to content

Commit

Permalink
added selenium_server port and address and application address for co…
Browse files Browse the repository at this point in the history
…nfiguring selenium more dynamically
  • Loading branch information
cornel.borcean committed Jan 12, 2009
1 parent 0ce92df commit 0edffe0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 16 deletions.
11 changes: 11 additions & 0 deletions lib/webrat/core/configuration.rb
Expand Up @@ -37,11 +37,22 @@ class Configuration
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:
Expand Down
47 changes: 31 additions & 16 deletions spec/private/core/configuration_spec.rb
Expand Up @@ -25,16 +25,6 @@
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
Expand All @@ -45,17 +35,42 @@
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}")
config.mode = mode
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

0 comments on commit 0edffe0

Please sign in to comment.