summaryrefslogtreecommitdiff
path: root/test/open-uri/test_open-uri.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-31 14:05:54 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-31 14:05:54 +0000
commitf07096f7e19a425a68101dc5fd79bc58e3f42f67 (patch)
tree02928416ce350c4f42736ab777a7109510f55ff3 /test/open-uri/test_open-uri.rb
parent6c6f9b19b4bc6256b4605b35f25fd9b4b530e0ba (diff)
Join threads.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/open-uri/test_open-uri.rb')
-rw-r--r--test/open-uri/test_open-uri.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/open-uri/test_open-uri.rb b/test/open-uri/test_open-uri.rb
index c6ba652..79ba9f5 100644
--- a/test/open-uri/test_open-uri.rb
+++ b/test/open-uri/test_open-uri.rb
@@ -24,13 +24,11 @@ class TestOpenURI < Test::Unit::TestCase
:Port => 0})
_, port, _, host = srv.listeners[0].addr
begin
- srv.start
+ th = srv.start
yield srv, dr, "http://#{host}:#{port}"
ensure
srv.shutdown
- until srv.status == :Stop
- sleep 0.1
- end
+ th.join
end
}
end
@@ -225,7 +223,7 @@ class TestOpenURI < Test::Unit::TestCase
_, proxy_port, _, proxy_host = proxy.listeners[0].addr
proxy_url = "http://#{proxy_host}:#{proxy_port}/"
begin
- proxy.start
+ proxy_thread = proxy.start
srv.mount_proc("/proxy", lambda { |req, res| res.body = "proxy" } )
open("#{url}/proxy", :proxy=>proxy_url) {|f|
assert_equal("200", f.status[0])
@@ -256,6 +254,7 @@ class TestOpenURI < Test::Unit::TestCase
assert_equal("", log); log.clear
ensure
proxy.shutdown
+ proxy_thread.join
end
}
end
@@ -278,7 +277,7 @@ class TestOpenURI < Test::Unit::TestCase
_, proxy_port, _, proxy_host = proxy.listeners[0].addr
proxy_url = "http://#{proxy_host}:#{proxy_port}/"
begin
- proxy.start
+ th = proxy.start
srv.mount_proc("/proxy", lambda { |req, res| res.body = "proxy" } )
exc = assert_raise(OpenURI::HTTPError) { open("#{url}/proxy", :proxy=>proxy_url) {} }
assert_equal("407", exc.io.status[0])
@@ -296,6 +295,7 @@ class TestOpenURI < Test::Unit::TestCase
assert_equal("", log); log.clear
ensure
proxy.shutdown
+ th.join
end
}
end