Add configurable startup logging as a block (#291)

Add overload for Kemal.run with just a block. This removes default logging.
This commit is contained in:
Michael Barrett 2017-01-15 13:41:07 -05:00 committed by Serdar Dogruyol
parent 42827c9a9d
commit 209a9e576c
2 changed files with 49 additions and 5 deletions

30
spec/run_spec.cr Normal file
View file

@ -0,0 +1,30 @@
require "./spec_helper"
describe "Run" do
it "runs a code block after starting" do
Kemal.config.env = "test"
make_me_true = false
Kemal.run do
make_me_true = true
Kemal.stop
end
make_me_true.should eq true
end
it "runs without a block being specified" do
Kemal.config.env = "test"
Kemal.run
Kemal.config.running.should eq true
Kemal.stop
end
it "runs with just a block" do
Kemal.config.env = "test"
make_me_true = false
Kemal.run do
make_me_true = true
Kemal.stop
end
make_me_true.should eq true
end
end