Rename common_log_handler and common_exception_handler

This commit is contained in:
Serdar Dogruyol 2017-10-06 20:34:18 +03:00
parent ac56973663
commit 5d737ee8f3
6 changed files with 21 additions and 21 deletions

View file

@ -1,6 +1,6 @@
require "./spec_helper"
describe "Kemal::CommonExceptionHandler" do
describe "Kemal::ExceptionHandler" do
it "renders 404 on route not found" do
get "/" do |env|
"Hello"
@ -10,7 +10,7 @@ describe "Kemal::CommonExceptionHandler" do
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
Kemal::CommonExceptionHandler::INSTANCE.call(context)
Kemal::ExceptionHandler::INSTANCE.call(context)
response.close
io.rewind
response = HTTP::Client::Response.from_io(io, decompress: false)
@ -28,8 +28,8 @@ describe "Kemal::CommonExceptionHandler" do
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
Kemal::CommonExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
Kemal::CommonExceptionHandler::INSTANCE.call(context)
Kemal::ExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
Kemal::ExceptionHandler::INSTANCE.call(context)
response.close
io.rewind
response = HTTP::Client::Response.from_io(io, decompress: false)
@ -49,8 +49,8 @@ describe "Kemal::CommonExceptionHandler" do
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
Kemal::CommonExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
Kemal::CommonExceptionHandler::INSTANCE.call(context)
Kemal::ExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
Kemal::ExceptionHandler::INSTANCE.call(context)
response.close
io.rewind
response = HTTP::Client::Response.from_io(io, decompress: false)
@ -71,8 +71,8 @@ describe "Kemal::CommonExceptionHandler" do
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
Kemal::CommonExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
Kemal::CommonExceptionHandler::INSTANCE.call(context)
Kemal::ExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
Kemal::ExceptionHandler::INSTANCE.call(context)
response.close
io.rewind
response = HTTP::Client::Response.from_io(io, decompress: false)
@ -93,8 +93,8 @@ describe "Kemal::CommonExceptionHandler" do
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
Kemal::CommonExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
Kemal::CommonExceptionHandler::INSTANCE.call(context)
Kemal::ExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
Kemal::ExceptionHandler::INSTANCE.call(context)
response.close
io.rewind
response = HTTP::Client::Response.from_io(io, decompress: false)

View file

@ -1,10 +1,10 @@
require "./spec_helper"
describe "Kemal::CommonLogHandler" do
describe "Kemal::LogHandler" do
it "logs to the given IO" do
config = Kemal.config
io = IO::Memory.new
logger = Kemal::CommonLogHandler.new io
logger = Kemal::LogHandler.new io
logger.write "Something"
io.to_s.should eq "Something"
end
@ -15,7 +15,7 @@ describe "Kemal::CommonLogHandler" do
context_io = IO::Memory.new
response = HTTP::Server::Response.new(context_io)
context = HTTP::Server::Context.new(request, response)
logger = Kemal::CommonLogHandler.new io
logger = Kemal::LogHandler.new io
logger.call(context)
io.to_s.should_not be nil
end