diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-06-27 03:30:39 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-06-27 03:42:43 +0000 |
commit | 18318887920773d43b72e9fb6490d3e74674bcf0 (patch) | |
tree | 94d0a2d11aad58c9b48e2f726bfe0138d5c1d57f /test/test_linux_middleware.rb | |
parent | ad3bf417b45d50be7b0121b5dacca2bc95b7953b (diff) | |
download | raindrops-18318887920773d43b72e9fb6490d3e74674bcf0.tar.gz |
Found in the check-warnings target in pkg.mk
Diffstat (limited to 'test/test_linux_middleware.rb')
-rw-r--r-- | test/test_linux_middleware.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test/test_linux_middleware.rb b/test/test_linux_middleware.rb index 670b853..f573225 100644 --- a/test/test_linux_middleware.rb +++ b/test/test_linux_middleware.rb @@ -11,12 +11,17 @@ class TestLinuxMiddleware < Test::Unit::TestCase @resp_headers = { 'Content-Type' => 'text/plain', 'Content-Length' => '0' } @response = [ 200, @resp_headers, [] ] @app = lambda { |env| @response } + @to_close = [] + end + + def teardown + @to_close.each { |io| io.close unless io.closed? } end def test_unix_listener tmp = Tempfile.new("") File.unlink(tmp.path) - us = UNIXServer.new(tmp.path) + @to_close << UNIXServer.new(tmp.path) app = Raindrops::Middleware.new(@app, :listeners => [tmp.path]) linux_extra = "#{tmp.path} active: 0\n#{tmp.path} queued: 0\n" response = app.call("PATH_INFO" => "/_raindrops") @@ -37,8 +42,8 @@ class TestLinuxMiddleware < Test::Unit::TestCase def test_unix_listener_queued tmp = Tempfile.new("") File.unlink(tmp.path) - us = UNIXServer.new(tmp.path) - uc = UNIXSocket.new(tmp.path) + @to_close << UNIXServer.new(tmp.path) + @to_close << UNIXSocket.new(tmp.path) app = Raindrops::Middleware.new(@app, :listeners => [tmp.path]) linux_extra = "#{tmp.path} active: 0\n#{tmp.path} queued: 1\n" response = app.call("PATH_INFO" => "/_raindrops") |