summaryrefslogtreecommitdiff
path: root/test/open-uri/test_open-uri.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-09 11:51:06 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-09 11:51:06 +0000
commit070c310e87d04865da1b4f217432e22cfae5e380 (patch)
treed11d9ef6c67b447bc886182b9c02e38aa70a3a00 /test/open-uri/test_open-uri.rb
parent9b559f194c9960e66011b8f40d428fe36cb302be (diff)
* test/webrick: Store log in an array.
* test/net/http: Ditto. * test/open-uri: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/open-uri/test_open-uri.rb')
-rw-r--r--test/open-uri/test_open-uri.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/test/open-uri/test_open-uri.rb b/test/open-uri/test_open-uri.rb
index 816d7fa..d2d8840 100644
--- a/test/open-uri/test_open-uri.rb
+++ b/test/open-uri/test_open-uri.rb
@@ -14,7 +14,7 @@ class TestOpenURI < Test::Unit::TestCase
end
def with_http(log_is_empty=true)
- log = StringIO.new('')
+ log = []
logger = WEBrick::Log.new(log, WEBrick::BasicLog::WARN)
Dir.mktmpdir {|dr|
srv = WEBrick::HTTPServer.new({
@@ -34,7 +34,7 @@ class TestOpenURI < Test::Unit::TestCase
end
}
if log_is_empty
- assert_equal("", log.string)
+ assert_equal([], log)
end
end
@@ -92,7 +92,8 @@ class TestOpenURI < Test::Unit::TestCase
}
server_thread2 = Thread.new {
server_thread.join
- assert_match(%r{ERROR `/not-exist' not found}, server_log.string)
+ assert_equal(1, server_log.length)
+ assert_match(%r{ERROR `/not-exist' not found}, server_log[0])
}
assert_join_threads([client_thread, server_thread2])
}
@@ -486,7 +487,8 @@ class TestOpenURI < Test::Unit::TestCase
}
server_thread2 = Thread.new {
server_thread.join
- assert_match(/ERROR WEBrick::HTTPStatus::Unauthorized/, server_log.string)
+ assert_equal(1, server_log.length)
+ assert_match(/ERROR WEBrick::HTTPStatus::Unauthorized/, server_log[0])
}
assert_join_threads([client_thread, server_thread2])
}
@@ -505,7 +507,8 @@ class TestOpenURI < Test::Unit::TestCase
}
server_thread2 = Thread.new {
server_thread.join
- assert_match(/ERROR WEBrick::HTTPStatus::Unauthorized/, server_log.string)
+ assert_equal(1, server_log.length)
+ assert_match(/ERROR WEBrick::HTTPStatus::Unauthorized/, server_log[0])
}
assert_join_threads([client_thread, server_thread2])
}