From 6b034c3b2f9e54ebbdedd929a5f4c841952a7a04 Mon Sep 17 00:00:00 2001 From: sdogruyol Date: Tue, 22 Nov 2016 23:29:10 +0300 Subject: [PATCH] Rename MemoryIO to IO::Memory since it's deprecated on Crystal 0.20.0 --- spec/common_exception_handler_spec.cr | 10 +++++----- spec/common_log_handler_spec.cr | 6 +++--- spec/context_spec.cr | 2 +- spec/init_handler_spec.cr | 4 ++-- spec/middleware/csrf_spec.cr | 2 +- spec/spec_helper.cr | 8 ++++---- spec/static_file_handler.cr | 2 +- src/kemal/helpers/macros.cr | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/spec/common_exception_handler_spec.cr b/spec/common_exception_handler_spec.cr index 5442306..75ff2e9 100644 --- a/spec/common_exception_handler_spec.cr +++ b/spec/common_exception_handler_spec.cr @@ -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 diff --git a/spec/common_log_handler_spec.cr b/spec/common_log_handler_spec.cr index 840c79d..1e4585c 100644 --- a/spec/common_log_handler_spec.cr +++ b/spec/common_log_handler_spec.cr @@ -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 diff --git a/spec/context_spec.cr b/spec/context_spec.cr index af8cc1d..b9e9003 100644 --- a/spec/context_spec.cr +++ b/spec/context_spec.cr @@ -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) diff --git a/spec/init_handler_spec.cr b/spec/init_handler_spec.cr index 9639474..d877249 100644 --- a/spec/init_handler_spec.cr +++ b/spec/init_handler_spec.cr @@ -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) diff --git a/spec/middleware/csrf_spec.cr b/spec/middleware/csrf_spec.cr index 62aae20..198c4b4 100644 --- a/spec/middleware/csrf_spec.cr +++ b/spec/middleware/csrf_spec.cr @@ -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) diff --git a/spec/spec_helper.cr b/spec/spec_helper.cr index 4eb469d..9c2b488 100644 --- a/spec/spec_helper.cr +++ b/spec/spec_helper.cr @@ -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 diff --git a/spec/static_file_handler.cr b/spec/static_file_handler.cr index 31ce94f..0861018 100644 --- a/spec/static_file_handler.cr +++ b/spec/static_file_handler.cr @@ -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 diff --git a/src/kemal/helpers/macros.cr b/src/kemal/helpers/macros.cr index 2f9b978..d263858 100644 --- a/src/kemal/helpers/macros.cr +++ b/src/kemal/helpers/macros.cr @@ -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 }