mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
b638dd1948
* Bump minitest version. * Add basic test helper file. * Use minitest for web server tests. * Use Minitest for unix socket tests. * Use Minitest for ThreadPool tests. * Use Minitest for TCP-Rack tests * Use Minitest for TCPLogger tests. * Add missing helper to test helpers. * Use Minitest for Rack server tests. * Use Minitest for Rack handler tests. * Use Minitest for Puma::Server tests. * Use Minitest for Puma::Server with SSL tests. * Use Minitest for persisten connections tests. * Require puma in test_helper file. * Use minitest for Puma::NullIO tests. * Remove unnecessary requires on test files. * Use Minitest for MiniSSL tests. * Use Minitest for IOBuffer tests. * Require bundler/setup in Rakefile. * Use Minitest for HttpParser tests. * Use Minitest for Puma::Configuration tests. * Use Minitest for Puma::CLI tests. * Bump Minitest version for Ruby 2.1 Gemfile. * Use Minitest for integration tests. * Use Minitest for Puma::App::Status tests. * Remove test-unit from Gemfiles. * Add timeout helper to Minitest::Test. * Use Minitest for Puma::Binder tests. * Remove testhelp file. * Add missing require to Puma::Binder tests. * Prefer require instead of require_relative.
35 lines
765 B
Ruby
35 lines
765 B
Ruby
require "test_helper"
|
|
|
|
# UNIX sockets are not recommended on JRuby
|
|
# (or Windows)
|
|
unless defined?(JRUBY_VERSION) || RbConfig::CONFIG["host_os"] =~ /mingw|mswin/
|
|
class TestPumaUnixSocket < Minitest::Test
|
|
|
|
App = lambda { |env| [200, {}, ["Works"]] }
|
|
|
|
Path = "test/puma.sock"
|
|
|
|
def setup
|
|
@server = Puma::Server.new App
|
|
@server.add_unix_listener Path
|
|
@server.run
|
|
end
|
|
|
|
def teardown
|
|
@server.stop(true)
|
|
File.unlink Path if File.exist? Path
|
|
end
|
|
|
|
def test_server
|
|
sock = UNIXSocket.new Path
|
|
|
|
sock << "GET / HTTP/1.0\r\nHost: blah.com\r\n\r\n"
|
|
|
|
expected = "HTTP/1.0 200 OK\r\nContent-Length: 5\r\n\r\nWorks"
|
|
|
|
assert_equal expected, sock.read(expected.size)
|
|
|
|
sock.close
|
|
end
|
|
end
|
|
end
|