Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 40 lines (28 sloc) 0.868 kb
af609a1 @luislavena Exclude UNIXSocket tests under Windows
luislavena authored
1 require "rbconfig"
597218e @evanphx Add unix socket support
evanphx authored
2 require 'test/unit'
3 require 'puma/server'
4
5 require 'socket'
6
d692475 @headius First pass updating JRuby bits for Puma.
headius authored
7 # UNIX sockets are not recommended on JRuby
af609a1 @luislavena Exclude UNIXSocket tests under Windows
luislavena authored
8 # (or Windows)
9 unless defined?(JRUBY_VERSION) || RbConfig::CONFIG["host_os"] =~ /mingw|mswin/
d692475 @headius First pass updating JRuby bits for Puma.
headius authored
10 class TestPumaUnixSocket < Test::Unit::TestCase
11
12 App = lambda { |env| [200, {}, ["Works"]] }
13
14 Path = "test/puma.sock"
15
16 def setup
17 @server = Puma::Server.new App
18 @server.add_unix_listener Path
19 @server.run
20 end
21
22 def teardown
23 @server.stop(true)
24 File.unlink Path if File.exists? Path
25 end
26
27 def test_server
28 sock = UNIXSocket.new Path
29
30 sock << "GET / HTTP/1.0\r\nHost: blah.com\r\n\r\n"
31
32 expected = "HTTP/1.0 200 OK\r\nConnection: close\r\nContent-Length: 5\r\n\r\nWorks"
33
34 assert_equal expected, sock.read(expected.size)
35
36 sock.close
37 end
597218e @evanphx Add unix socket support
evanphx authored
38 end
af609a1 @luislavena Exclude UNIXSocket tests under Windows
luislavena authored
39 end
Something went wrong with that request. Please try again.