invidious/lib/kemal/spec/log_handler_spec.cr
Leon Klingele 40fb17791e
shard: track dependencies
Commit the whole ./lib/ folder which stores the Crystal dependencies.
This has a few benefits:

- Allows to build the project without a connection to the Internet
  to retrieve dependencies.
- Makes the project resistant against dependency re-tags which might
  include malicious code.
2019-08-15 01:51:27 +02:00

22 lines
583 B
Crystal

require "./spec_helper"
describe "Kemal::LogHandler" do
it "logs to the given IO" do
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