mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Refactor global namespace DSL into OOP Kemal::Base
This commit is contained in:
parent
a5d8df7382
commit
aaa2109837
25 changed files with 420 additions and 387 deletions
|
@ -1,5 +1,7 @@
|
|||
require "./spec_helper"
|
||||
|
||||
private INSTANCE = Kemal::ExceptionHandler.new
|
||||
|
||||
describe "Kemal::ExceptionHandler" do
|
||||
it "renders 404 on route not found" do
|
||||
get "/" do
|
||||
|
@ -10,7 +12,7 @@ describe "Kemal::ExceptionHandler" do
|
|||
io = IO::Memory.new
|
||||
response = HTTP::Server::Response.new(io)
|
||||
context = HTTP::Server::Context.new(request, response)
|
||||
Kemal::ExceptionHandler::INSTANCE.call(context)
|
||||
INSTANCE.call(context)
|
||||
response.close
|
||||
io.rewind
|
||||
response = HTTP::Client::Response.from_io(io, decompress: false)
|
||||
|
@ -28,8 +30,9 @@ describe "Kemal::ExceptionHandler" do
|
|||
io = IO::Memory.new
|
||||
response = HTTP::Server::Response.new(io)
|
||||
context = HTTP::Server::Context.new(request, response)
|
||||
Kemal::ExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
|
||||
Kemal::ExceptionHandler::INSTANCE.call(context)
|
||||
context.app = Kemal.application
|
||||
INSTANCE.next = Kemal::RouteHandler.new
|
||||
INSTANCE.call(context)
|
||||
response.close
|
||||
io.rewind
|
||||
response = HTTP::Client::Response.from_io(io, decompress: false)
|
||||
|
@ -49,8 +52,9 @@ describe "Kemal::ExceptionHandler" do
|
|||
io = IO::Memory.new
|
||||
response = HTTP::Server::Response.new(io)
|
||||
context = HTTP::Server::Context.new(request, response)
|
||||
Kemal::ExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
|
||||
Kemal::ExceptionHandler::INSTANCE.call(context)
|
||||
context.app = Kemal.application
|
||||
INSTANCE.next = Kemal::RouteHandler.new
|
||||
INSTANCE.call(context)
|
||||
response.close
|
||||
io.rewind
|
||||
response = HTTP::Client::Response.from_io(io, decompress: false)
|
||||
|
@ -71,8 +75,9 @@ describe "Kemal::ExceptionHandler" do
|
|||
io = IO::Memory.new
|
||||
response = HTTP::Server::Response.new(io)
|
||||
context = HTTP::Server::Context.new(request, response)
|
||||
Kemal::ExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
|
||||
Kemal::ExceptionHandler::INSTANCE.call(context)
|
||||
context.app = Kemal.application
|
||||
INSTANCE.next = Kemal::RouteHandler.new
|
||||
INSTANCE.call(context)
|
||||
response.close
|
||||
io.rewind
|
||||
response = HTTP::Client::Response.from_io(io, decompress: false)
|
||||
|
@ -93,8 +98,9 @@ describe "Kemal::ExceptionHandler" do
|
|||
io = IO::Memory.new
|
||||
response = HTTP::Server::Response.new(io)
|
||||
context = HTTP::Server::Context.new(request, response)
|
||||
Kemal::ExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
|
||||
Kemal::ExceptionHandler::INSTANCE.call(context)
|
||||
context.app = Kemal.application
|
||||
INSTANCE.next = Kemal::RouteHandler.new
|
||||
INSTANCE.call(context)
|
||||
response.close
|
||||
io.rewind
|
||||
response = HTTP::Client::Response.from_io(io, decompress: false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue