mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Handle POST request, and some refactors
This commit is contained in:
parent
e601730a0c
commit
fc4f648c1a
6 changed files with 39 additions and 14 deletions
|
@ -2,15 +2,20 @@ require "spec_helper"
|
|||
|
||||
describe "Route" do
|
||||
describe "match" do
|
||||
it "doesn't match" do
|
||||
route = Route.new("/foo/bar", nil)
|
||||
route.match(nil, "/foo/baz".split("/")).should be_nil
|
||||
it "doesn't match because of route" do
|
||||
route = Route.new("GET", "/foo/bar") { "" }
|
||||
route.match("GET", "/foo/baz".split("/")).should be_nil
|
||||
end
|
||||
|
||||
it "doesn't match because of method" do
|
||||
route = Route.new("GET", "/foo/bar") { "" }
|
||||
route.match("POST", "/foo/bar".split("/")).should be_nil
|
||||
end
|
||||
|
||||
it "matches" do
|
||||
route = Route.new("/foo/:one/path/:two", nil)
|
||||
request = route.match(nil, "/foo/uno/path/dos".split("/"))
|
||||
request.not_nil!.params.should eq({"one" => "uno", "two" => "dos"})
|
||||
route = Route.new("GET", "/foo/:one/path/:two") { "" }
|
||||
params = route.match("GET", "/foo/uno/path/dos".split("/"))
|
||||
params.should eq({"one" => "uno", "two" => "dos"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue