diff --git a/lib/webrat/core/configuration.rb b/lib/webrat/core/configuration.rb index 98bb674..151c6c9 100755 --- a/lib/webrat/core/configuration.rb +++ b/lib/webrat/core/configuration.rb @@ -58,6 +58,9 @@ module Webrat # loop? Defaults to 10 attr_accessor :infinite_redirect_limit + # What is the path to the rack config file used to start the application server in selenium+sinatra mode? Defaults to "config.ru". + attr_accessor :rack_config + def initialize # :nodoc: self.open_error_files = true self.application_environment = :test @@ -68,6 +71,7 @@ module Webrat self.infinite_redirect_limit = 10 self.selenium_browser_key = '*firefox' self.selenium_browser_startup_timeout = 5 + self.rack_config = "config.ru" end def open_error_files? #:nodoc: diff --git a/lib/webrat/selenium/application_servers/sinatra.rb b/lib/webrat/selenium/application_servers/sinatra.rb index 6c78495..aca3e77 100644 --- a/lib/webrat/selenium/application_servers/sinatra.rb +++ b/lib/webrat/selenium/application_servers/sinatra.rb @@ -8,7 +8,7 @@ module Webrat def start fork do File.open('rack.pid', 'w') { |fp| fp.write Process.pid } - exec 'rackup', File.expand_path(Dir.pwd + '/config.ru'), '-p', Webrat.configuration.application_port.to_s + exec 'rackup', File.expand_path(Dir.pwd + '/' + Webrat.configuration.rack_config), '-p', Webrat.configuration.application_port.to_s end end diff --git a/spec/private/core/configuration_spec.rb b/spec/private/core/configuration_spec.rb index 165ce4f..42f584a 100755 --- a/spec/private/core/configuration_spec.rb +++ b/spec/private/core/configuration_spec.rb @@ -82,6 +82,15 @@ describe Webrat::Configuration do @config.selenium_browser_startup_timeout = 10 @config.selenium_browser_startup_timeout.should == 10 end + + it 'should have a rack config.ru file' do + @config.rack_config.should == "config.ru" + end + + it 'should allow changing the path to the rack config.ru file' do + @config.rack_config = "foo/bar.ru" + @config.rack_config.should == "foo/bar.ru" + end end end