2015-11-14 21:45:20 +00:00
|
|
|
require "./spec_helper"
|
|
|
|
|
|
|
|
class CustomTestHandler < HTTP::Handler
|
|
|
|
def call(request)
|
|
|
|
call_next request
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "Config" do
|
|
|
|
it "sets default port to 3000" do
|
|
|
|
config = Kemal.config
|
|
|
|
config.port.should eq 3000
|
|
|
|
end
|
|
|
|
|
2015-11-18 20:45:49 +00:00
|
|
|
it "sets default environment to development" do
|
|
|
|
config = Kemal.config
|
|
|
|
config.env.should eq "development"
|
|
|
|
end
|
|
|
|
|
|
|
|
it "set environment to production" do
|
|
|
|
config = Kemal.config
|
|
|
|
config.env = "production"
|
|
|
|
config.env.should eq "production"
|
|
|
|
end
|
|
|
|
|
2015-11-14 21:45:20 +00:00
|
|
|
it "adds a custom handler" do
|
|
|
|
config = Kemal.config
|
|
|
|
config.add_handler CustomTestHandler.new
|
|
|
|
config.handlers.size.should eq(1)
|
|
|
|
end
|
|
|
|
end
|