changed selenium_environment to application_environment and deprecated selenium_environment and selenium_port
This commit is contained in:
parent
8932544d46
commit
0ce92dfcd8
@ -1,3 +1,5 @@
|
|||||||
|
require "webrat/core_extensions/deprecate"
|
||||||
|
|
||||||
module Webrat
|
module Webrat
|
||||||
|
|
||||||
# Configures Webrat. If this is not done, Webrat will be created
|
# Configures Webrat. If this is not done, Webrat will be created
|
||||||
@ -27,16 +29,18 @@ module Webrat
|
|||||||
# Save and open pages with error status codes (500-599) in a browser? Defualts to true.
|
# Save and open pages with error status codes (500-599) in a browser? Defualts to true.
|
||||||
attr_writer :open_error_files
|
attr_writer :open_error_files
|
||||||
|
|
||||||
# Which environment should the selenium tests be run in? Defaults to selenium.
|
# Which rails environment should the selenium tests be run in? Defaults to selenium.
|
||||||
attr_accessor :selenium_environment
|
attr_accessor :application_environment
|
||||||
|
webrat_deprecate :selenium_environment, :application_environment
|
||||||
|
|
||||||
# Which port is the application running on for selenium testing? Defaults to 3001.
|
# Which port is the application running on for selenium testing? Defaults to 3001.
|
||||||
attr_accessor :application_port
|
attr_accessor :application_port
|
||||||
|
webrat_deprecate :selenium_port, :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.application_environment = :selenium
|
||||||
self.application_port = 3001
|
self.application_port = 3001
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ 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.application_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.application_environment} --pid #{pid_file} &")
|
||||||
TCPSocket.wait_for_service :host => "0.0.0.0", :port => Webrat.configuration.application_port.to_i
|
TCPSocket.wait_for_service :host => "0.0.0.0", :port => Webrat.configuration.application_port.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -25,9 +25,9 @@ describe Webrat::Configuration do
|
|||||||
config.should open_error_files
|
config.should open_error_files
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should use 'selenium' as the selenium environment by default" do
|
it "should use 'selenium' as the application environment by default" do
|
||||||
config = Webrat::Configuration.new
|
config = Webrat::Configuration.new
|
||||||
config.selenium_environment.should == :selenium
|
config.application_environment.should == :selenium
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should use 3001 as the application port by default" do
|
it "should use 3001 as the application port by default" do
|
||||||
@ -57,9 +57,5 @@ describe Webrat::Configuration do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "Selenium config" do
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ describe Webrat, "Selenium" do
|
|||||||
it "should start the app server with correct config options" do
|
it "should start the app server with correct config options" do
|
||||||
pid_file = "file"
|
pid_file = "file"
|
||||||
File.should_receive(:expand_path).with(RAILS_ROOT + "/tmp/pids/mongrel_selenium.pid").and_return pid_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} &")
|
Webrat.should_receive(:system).with("mongrel_rails start -d --chdir=#{RAILS_ROOT} --port=#{Webrat.configuration.application_port} --environment=#{Webrat.configuration.application_environment} --pid #{pid_file} &")
|
||||||
TCPSocket.should_receive(:wait_for_service).with(:host => "0.0.0.0", :port => Webrat.configuration.application_port.to_i)
|
TCPSocket.should_receive(:wait_for_service).with(:host => "0.0.0.0", :port => Webrat.configuration.application_port.to_i)
|
||||||
Webrat.start_app_server
|
Webrat.start_app_server
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user