changed selenium_port to application_port to reflect what the variable is used for ...
This commit is contained in:
parent
9825aee47e
commit
33d2cdcc53
@ -31,13 +31,13 @@ module Webrat
|
|||||||
attr_accessor :selenium_environment
|
attr_accessor :selenium_environment
|
||||||
|
|
||||||
# Which port should the selenium tests be run on? Defaults to 3001.
|
# Which port should the selenium tests be run on? Defaults to 3001.
|
||||||
attr_accessor :selenium_port
|
attr_accessor :application_port
|
||||||
|
|
||||||
def initialize # :nodoc:
|
def initialize # :nodoc:
|
||||||
self.open_error_files = true
|
self.open_error_files = true
|
||||||
self.parse_with_nokogiri = !Webrat.on_java?
|
self.parse_with_nokogiri = !Webrat.on_java?
|
||||||
self.selenium_environment = :selenium
|
self.selenium_environment = :selenium
|
||||||
self.selenium_port = 3001
|
self.application_port = 3001
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_with_nokogiri? #:nodoc:
|
def parse_with_nokogiri? #:nodoc:
|
||||||
|
@ -26,8 +26,8 @@ module Webrat
|
|||||||
|
|
||||||
def self.start_app_server #:nodoc:
|
def self.start_app_server #:nodoc:
|
||||||
pid_file = File.expand_path(RAILS_ROOT + "/tmp/pids/mongrel_selenium.pid")
|
pid_file = File.expand_path(RAILS_ROOT + "/tmp/pids/mongrel_selenium.pid")
|
||||||
system("mongrel_rails start -d --chdir=#{RAILS_ROOT} --port=#{Webrat.configuration.selenium_port} --environment=#{Webrat.configuration.selenium_environment} --pid #{pid_file} &")
|
system("mongrel_rails start -d --chdir=#{RAILS_ROOT} --port=#{Webrat.configuration.application_port} --environment=#{Webrat.configuration.selenium_environment} --pid #{pid_file} &")
|
||||||
TCPSocket.wait_for_service :host => "0.0.0.0", :port => Webrat.configuration.selenium_port.to_i
|
TCPSocket.wait_for_service :host => "0.0.0.0", :port => Webrat.configuration.application_port.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.stop_app_server #:nodoc:
|
def self.stop_app_server #:nodoc:
|
||||||
|
@ -30,9 +30,9 @@ describe Webrat::Configuration do
|
|||||||
config.selenium_environment.should == :selenium
|
config.selenium_environment.should == :selenium
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should use 3001 as the selenium port by default" do
|
it "should use 3001 as the application port by default" do
|
||||||
config = Webrat::Configuration.new
|
config = Webrat::Configuration.new
|
||||||
config.selenium_port.should == 3001
|
config.application_port.should == 3001
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should be configurable with a block" do
|
it "should be configurable with a block" do
|
||||||
@ -56,4 +56,10 @@ describe Webrat::Configuration do
|
|||||||
config.mode = mode
|
config.mode = mode
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "Selenium config" do
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
19
spec/private/selenium/selenium_spec.rb
Normal file
19
spec/private/selenium/selenium_spec.rb
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
||||||
|
require "action_controller"
|
||||||
|
require "action_controller/integration"
|
||||||
|
require "webrat/selenium"
|
||||||
|
|
||||||
|
RAILS_ROOT = "/"
|
||||||
|
|
||||||
|
|
||||||
|
describe Webrat, "Selenium" do
|
||||||
|
|
||||||
|
it "should start the app server with correct config options" do
|
||||||
|
pid_file = "file"
|
||||||
|
File.should_receive(:expand_path).with(RAILS_ROOT + "/tmp/pids/mongrel_selenium.pid").and_return pid_file
|
||||||
|
Webrat.should_receive(:system).with("mongrel_rails start -d --chdir=#{RAILS_ROOT} --port=#{Webrat.configuration.application_port} --environment=#{Webrat.configuration.selenium_environment} --pid #{pid_file} &")
|
||||||
|
TCPSocket.should_receive(:wait_for_service).with(:host => "0.0.0.0", :port => Webrat.configuration.application_port.to_i)
|
||||||
|
Webrat.start_app_server
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user