From eda1ea00904dcf4b4e7ed533b327a842713ac11a Mon Sep 17 00:00:00 2001 From: luislavena Date: Mon, 31 Mar 2008 08:19:11 +0000 Subject: Remove fixed port numbers used in tests, make tests more friendly to CI tools. Use of #process_based_port as port number. Exclude DirHandler(nil) with absolute paths on Windows. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/branches/stable_1-2@999 19e92222-5c0b-0410-8929-a290d50e31e9 --- test/unit/test_configurator.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'test/unit/test_configurator.rb') diff --git a/test/unit/test_configurator.rb b/test/unit/test_configurator.rb index f55a8ae..dc9713a 100644 --- a/test/unit/test_configurator.rb +++ b/test/unit/test_configurator.rb @@ -29,11 +29,12 @@ end class ConfiguratorTest < Test::Unit::TestCase def test_base_handler_config + @port = process_based_port @config = nil redirect_test_io do @config = Mongrel::Configurator.new :host => "localhost" do - listener :port => 4501 do + listener :port => process_based_port do # 2 in front should run, but the sentinel shouldn't since dirhandler processes the request uri "/", :handler => plugin("/handlers/testplugin") uri "/", :handler => plugin("/handlers/testplugin") @@ -55,7 +56,7 @@ class ConfiguratorTest < Test::Unit::TestCase end end end - + # pp @config.listeners.values.first.classifier.routes @config.listeners.each do |host,listener| @@ -64,12 +65,12 @@ class ConfiguratorTest < Test::Unit::TestCase assert listener.classifier.uris.include?("/test"), "/test not registered" end - res = Net::HTTP.get(URI.parse('http://localhost:4501/test')) + res = Net::HTTP.get(URI.parse("http://localhost:#{@port}/test")) assert res != nil, "Didn't get a response" assert $test_plugin_fired == 3, "Test filter plugin didn't run 3 times." redirect_test_io do - res = Net::HTTP.get(URI.parse('http://localhost:4501/')) + res = Net::HTTP.get(URI.parse("http://localhost:#{@port}/")) assert res != nil, "Didn't get a response" assert $test_plugin_fired == 6, "Test filter plugin didn't run 6 times." @@ -80,7 +81,7 @@ class ConfiguratorTest < Test::Unit::TestCase end assert_raise Errno::EBADF, Errno::ECONNREFUSED do - res = Net::HTTP.get(URI.parse("http://localhost:4501/")) + res = Net::HTTP.get(URI.parse("http://localhost:#{@port}/")) end end -- cgit v1.2.3-24-ge0c7