All specs passing except macros

This commit is contained in:
Sdogruyol 2016-01-24 12:22:25 +02:00
parent c6e9e7a827
commit d1f95c0f39
17 changed files with 243 additions and 247 deletions

View file

@ -10,6 +10,29 @@ class CustomTestHandler < HTTP::Handler
end
end
def create_request_and_return_io(handler, request)
io = MemoryIO.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
handler.call(context)
response.close
io.rewind
io
end
def create_ws_request_and_return_io(handler, request)
io = MemoryIO.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
begin
handler.call context
rescue IO::Error
# Raises because the MemoryIO is empty
end
response.close
io
end
Spec.before_each do
Kemal.config.env = "development"
Kemal.config.handlers.clear