mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Refactor and fix some docs
This commit is contained in:
parent
11295f0584
commit
536108c71b
5 changed files with 1 additions and 5 deletions
22
spec/log_handler_spec.cr
Normal file
22
spec/log_handler_spec.cr
Normal file
|
@ -0,0 +1,22 @@
|
|||
require "./spec_helper"
|
||||
|
||||
describe "Kemal::LogHandler" do
|
||||
it "logs to the given IO" do
|
||||
config = Kemal.config
|
||||
io = IO::Memory.new
|
||||
logger = Kemal::LogHandler.new io
|
||||
logger.write "Something"
|
||||
io.to_s.should eq "Something"
|
||||
end
|
||||
|
||||
it "creates log message for each request" do
|
||||
request = HTTP::Request.new("GET", "/")
|
||||
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::LogHandler.new io
|
||||
logger.call(context)
|
||||
io.to_s.should_not be nil
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue