Vendor Rack 1.1

Also clean up some View stuff.
This commit is contained in:
Jacques Distler 2009-12-26 14:00:18 -06:00
parent 77014652a3
commit a705709f9a
74 changed files with 3080 additions and 608 deletions

View file

@ -44,6 +44,12 @@ context "Rack::URLMap" do
res["X-ScriptName"].should.equal "/foo/bar"
res["X-PathInfo"].should.equal "/"
res = Rack::MockRequest.new(map).get("/foo///bar//quux")
res.status.should.equal 200
res.should.be.ok
res["X-ScriptName"].should.equal "/foo/bar"
res["X-PathInfo"].should.equal "//quux"
res = Rack::MockRequest.new(map).get("/foo/quux", "SCRIPT_NAME" => "/bleh")
res.should.be.ok
res["X-ScriptName"].should.equal "/bleh/foo"
@ -182,4 +188,28 @@ context "Rack::URLMap" do
res["X-PathInfo"].should.equal "/"
res["X-ScriptName"].should.equal ""
end
specify "should not squeeze slashes" do
map = Rack::URLMap.new("/" => lambda { |env|
[200,
{ "Content-Type" => "text/plain",
"X-Position" => "root",
"X-PathInfo" => env["PATH_INFO"],
"X-ScriptName" => env["SCRIPT_NAME"]
}, [""]]},
"/foo" => lambda { |env|
[200,
{ "Content-Type" => "text/plain",
"X-Position" => "foo",
"X-PathInfo" => env["PATH_INFO"],
"X-ScriptName" => env["SCRIPT_NAME"]
}, [""]]}
)
res = Rack::MockRequest.new(map).get("/http://example.org/bar")
res.should.be.ok
res["X-Position"].should.equal "root"
res["X-PathInfo"].should.equal "/http://example.org/bar"
res["X-ScriptName"].should.equal ""
end
end