diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-31 14:05:54 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-31 14:05:54 +0000 |
commit | f07096f7e19a425a68101dc5fd79bc58e3f42f67 (patch) | |
tree | 02928416ce350c4f42736ab777a7109510f55ff3 /test/open-uri/test_open-uri.rb | |
parent | 6c6f9b19b4bc6256b4605b35f25fd9b4b530e0ba (diff) | |
download | ruby-f07096f7e19a425a68101dc5fd79bc58e3f42f67.tar.gz |
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.rb | 12 |
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 c6ba652a6b..79ba9f5827 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 |