Sha256: b8d9c782d4c8398e11b907f456cff5d8e021705c86b0da26de950481fcaac6ab
Contents?: true
Size: 1.52 KB
Versions: 8
Compression:
Stored size: 1.52 KB
Contents
# -*- encoding: binary -*- require 'test/unit' require 'tempfile' require 'raindrops' require 'socket' $stderr.sync = $stdout.sync = true class TestLinuxMiddleware < Test::Unit::TestCase def setup @resp_headers = { 'Content-Type' => 'text/plain', 'Content-Length' => '0' } @response = [ 200, @resp_headers, [] ] @app = lambda { |env| @response } end def test_unix_listener tmp = Tempfile.new("") File.unlink(tmp.path) us = 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") expect = [ 200, { "Content-Type" => "text/plain", "Content-Length" => (22 + linux_extra.size).to_s }, [ "calling: 0\nwriting: 0\n#{linux_extra}" \ ] ] assert_equal expect, response end def test_unix_listener_queued tmp = Tempfile.new("") File.unlink(tmp.path) us = UNIXServer.new(tmp.path) uc = 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") expect = [ 200, { "Content-Type" => "text/plain", "Content-Length" => (22 + linux_extra.size).to_s }, [ "calling: 0\nwriting: 0\n#{linux_extra}" \ ] ] assert_equal expect, response end end if RUBY_PLATFORM =~ /linux/
Version data entries
8 entries across 8 versions & 1 rubygems