test/spec_file.rb in rack-2.0.0.alpha vs test/spec_file.rb in rack-2.0.0.rc1

- old
+ new

@@ -66,10 +66,15 @@ # (/ruby/).must_match res # This is wierd, but an oddity of minitest # assert_match(/ruby/, res) # nope assert_match(res, /ruby/) end + it "serve uri with URL encoded null byte (%00) in filenames" do + res = Rack::MockRequest.new(file(DOCROOT)).get("/cgi/test%00") + res.must_be :bad_request? + end + it "allow safe directory traversal" do req = Rack::MockRequest.new(file(DOCROOT)) res = req.get('/cgi/../cgi/test') res.must_be :successful? @@ -233,8 +238,14 @@ it "not set Content-Type if the mime type is not set" do req = Rack::MockRequest.new(Rack::Lint.new(Rack::File.new(DOCROOT, nil, nil))) res = req.get "/cgi/test" res.must_be :successful? res['Content-Type'].must_equal nil + end + + it "return error when file not found for head request" do + res = Rack::MockRequest.new(file(DOCROOT)).head("/cgi/missing") + res.must_be :not_found? + res.body.must_be :empty? end end