Rename MemoryIO to IO::Memory since it's deprecated on Crystal 0.20.0

This commit is contained in:
sdogruyol 2016-11-22 23:29:10 +03:00
parent 733582f724
commit 6b034c3b2f
8 changed files with 18 additions and 18 deletions

View File

@ -7,7 +7,7 @@ describe "Kemal::CommonExceptionHandler" do
end
request = HTTP::Request.new("GET", "/asd")
io = MemoryIO.new
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
Kemal::CommonExceptionHandler::INSTANCE.call(context)
@ -25,7 +25,7 @@ describe "Kemal::CommonExceptionHandler" do
env.response.status_code = 403
end
request = HTTP::Request.new("GET", "/")
io = MemoryIO.new
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
Kemal::CommonExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
@ -46,7 +46,7 @@ describe "Kemal::CommonExceptionHandler" do
env.response.status_code = 500
end
request = HTTP::Request.new("GET", "/")
io = MemoryIO.new
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
Kemal::CommonExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
@ -68,7 +68,7 @@ describe "Kemal::CommonExceptionHandler" do
env.response.status_code = 500
end
request = HTTP::Request.new("GET", "/")
io = MemoryIO.new
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
Kemal::CommonExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
@ -90,7 +90,7 @@ describe "Kemal::CommonExceptionHandler" do
env.response.status_code = 500
end
request = HTTP::Request.new("GET", "/")
io = MemoryIO.new
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
Kemal::CommonExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE

View File

@ -3,7 +3,7 @@ require "./spec_helper"
describe "Kemal::CommonLogHandler" do
it "logs to the given IO" do
config = Kemal.config
io = MemoryIO.new
io = IO::Memory.new
logger = Kemal::CommonLogHandler.new io
logger.write "Something"
io.to_s.should eq "Something"
@ -11,8 +11,8 @@ describe "Kemal::CommonLogHandler" do
it "creates log message for each request" do
request = HTTP::Request.new("GET", "/")
io = MemoryIO.new
context_io = MemoryIO.new
io = IO::Memory.new
context_io = IO::Memory.new
response = HTTP::Server::Response.new(context_io)
context = HTTP::Server::Context.new(request, response)
logger = Kemal::CommonLogHandler.new io

View File

@ -49,7 +49,7 @@ describe "Context" do
}
end
request = HTTP::Request.new("GET", "/")
io = MemoryIO.new
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
Kemal::Middleware::Filter::INSTANCE.call(context)

View File

@ -3,7 +3,7 @@ require "./spec_helper"
describe "Kemal::InitHandler" do
it "initializes context with Content-Type: text/html" do
request = HTTP::Request.new("GET", "/")
io = MemoryIO.new
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
Kemal::InitHandler::INSTANCE.next = ->(context : HTTP::Server::Context) {}
@ -13,7 +13,7 @@ describe "Kemal::InitHandler" do
it "initializes context with X-Powered-By: Kemal" do
request = HTTP::Request.new("GET", "/")
io = MemoryIO.new
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
Kemal::InitHandler::INSTANCE.call(context)

View File

@ -62,7 +62,7 @@ describe "Kemal::Middleware::CSRF" do
end
def process_request(handler, request)
io = MemoryIO.new
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
handler.call(context)

View File

@ -13,7 +13,7 @@ class CustomLogHandler < Kemal::BaseLogHandler
end
def create_request_and_return_io(handler, request)
io = MemoryIO.new
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
handler.call(context)
@ -23,20 +23,20 @@ def create_request_and_return_io(handler, request)
end
def create_ws_request_and_return_io(handler, request)
io = MemoryIO.new
io = IO::Memory.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
# Raises because the IO::Memory is empty
end
response.close
io
end
def call_request_on_app(request)
io = MemoryIO.new
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
main_handler = build_main_handler

View File

@ -1,7 +1,7 @@
require "./spec_helper"
private def handle(request, fallthrough = true)
io = MemoryIO.new
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
handler = Kemal::StaticFileHandler.new "#{__DIR__}/static", fallthrough

View File

@ -33,7 +33,7 @@ CONTENT_FOR_BLOCKS = Hash(String, Tuple(String, Proc(String))).new
# setting the appropriate set of tags that should be added to the layout.
macro content_for(key, file = __FILE__)
%proc = ->() {
__kilt_io__ = MemoryIO.new
__kilt_io__ = IO::Memory.new
{{ yield }}
__kilt_io__.to_s
}