kemal/spec/config_spec.cr
2016-02-12 14:11:34 +02:00

38 lines
940 B
Crystal

require "./spec_helper"
describe "Config" do
it "sets default port to 3000" do
config = Kemal.config
config.port.should eq 3000
end
it "sets default environment to development" do
config = Kemal.config
config.env.should eq "development"
end
it "sets environment to production" do
config = Kemal.config
config.env = "production"
config.env.should eq "production"
end
it "sets host binding" do
config = Kemal.config
config.host_binding = "127.0.0.1"
config.host_binding.should eq "127.0.0.1"
end
it "adds a custom handler" do
config = Kemal.config
config.add_handler CustomTestHandler.new
config.handlers.size.should eq(1)
end
it "sets a custom logger" do
config = Kemal::Config::INSTANCE
config.logger = CustomLogHandler.new("production")
config.handlers.first.should be_a(CustomLogHandler)
config.logger.should be_a(CustomLogHandler)
end
end