Dynamically insert handlers. Fixes #376

This commit is contained in:
sdogruyol 2017-07-11 11:22:35 +03:00
parent dbbe05a610
commit 1d056b203b
7 changed files with 73 additions and 20 deletions

View file

@ -11,6 +11,7 @@ describe "Macros" do
describe "#add_handler" do
it "adds a custom handler" do
add_handler CustomTestHandler.new
Kemal.config.setup
Kemal.config.handlers.size.should eq 6
end
end
@ -24,7 +25,6 @@ describe "Macros" do
it "sets a custom logger" do
config = Kemal::Config::INSTANCE
logger CustomLogHandler.new
config.handlers[4].should be_a(CustomLogHandler)
config.logger.should be_a(CustomLogHandler)
end
end
@ -119,6 +119,7 @@ describe "Macros" do
describe "#gzip" do
it "adds HTTP::CompressHandler to handlers" do
gzip true
Kemal.config.setup
Kemal.config.handlers[4].should be_a(HTTP::CompressHandler)
end
end