kemal/spec/route_spec.cr

20 lines
580 B
Crystal
Raw Normal View History

require "./spec_helper"
2014-06-11 23:41:02 +00:00
describe "Route" do
2015-10-31 07:28:25 +00:00
describe "match?" do
it "matches the correct route" do
kemal = Kemal::RouteHandler::INSTANCE
2015-10-31 07:28:25 +00:00
kemal.add_route "GET", "/route1" do |env|
"Route 1"
end
kemal.add_route "GET", "/route2" do |env|
"Route 2"
end
request = HTTP::Request.new("GET", "/route2")
2016-01-24 10:22:25 +00:00
io_with_context = create_request_and_return_io(kemal, request)
client_response = HTTP::Client::Response.from_io(io_with_context, decompress: false)
client_response.body.should eq("Route 2")
2015-10-31 07:28:25 +00:00
end
2014-06-11 23:41:02 +00:00
end
end