From 3f443e6115cb4502f200db53e231487f83555d72 Mon Sep 17 00:00:00 2001 From: naruse Date: Wed, 4 Apr 2012 12:49:12 +0000 Subject: Use mount_proc to avoid the delay of writing data to files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/open-uri/test_ssl.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/open-uri/test_ssl.rb') diff --git a/test/open-uri/test_ssl.rb b/test/open-uri/test_ssl.rb index 64fc214ce5..08aba39643 100644 --- a/test/open-uri/test_ssl.rb +++ b/test/open-uri/test_ssl.rb @@ -26,7 +26,7 @@ class TestOpenURISSL < Test::Unit::TestCase :Port => 0}) _, port, _, host = srv.listeners[0].addr begin - th = srv.start + srv.start yield srv, dr, "https://#{host}:#{port}" ensure srv.shutdown @@ -48,7 +48,7 @@ class TestOpenURISSL < Test::Unit::TestCase with_https {|srv, dr, url| cacert_filename = "#{dr}/cacert.pem" open(cacert_filename, "w") {|f| f << CA_CERT } - open("#{dr}/data", "w") {|f| f << "ddd" } + srv.mount_proc("/data", lambda { |req, res| res.body = "ddd" } ) open("#{url}/data", :ssl_ca_cert => cacert_filename) {|f| assert_equal("200", f.status[0]) assert_equal("ddd", f.read) @@ -77,8 +77,8 @@ class TestOpenURISSL < Test::Unit::TestCase :Port => 0}) _, p_port, _, p_host = prxy.listeners[0].addr begin - th = prxy.start - open("#{dr}/proxy", "w") {|f| f << "proxy" } + prxy.start + srv.mount_proc("/proxy", lambda { |req, res| res.body = "proxy" } ) open("#{url}/proxy", :proxy=>"http://#{p_host}:#{p_port}/", :ssl_ca_cert => cacert_filename) {|f| assert_equal("200", f.status[0]) assert_equal("proxy", f.read) -- cgit v1.2.3