Sha256: f2e1227057f0c6ec6f92b22c0f3e8d0ce0c83bdaf5745f07d44f3bbb17ef4a5d
Contents?: true
Size: 939 Bytes
Versions: 3
Compression:
Stored size: 939 Bytes
Contents
require 'test/spec' require 'rack/file' require 'rack/lint' require 'rack/mock' context "Rack::File" do DOCROOT = File.expand_path(File.dirname(__FILE__)) specify "serves files" do res = Rack::MockRequest.new(Rack::Lint.new(Rack::File.new(DOCROOT))). get("/cgi/test") res.should.be.ok res.should =~ /ruby/ end specify "serves files with URL encoded filenames" do res = Rack::MockRequest.new(Rack::Lint.new(Rack::File.new(DOCROOT))). get("/cgi/%74%65%73%74") # "/cgi/test" res.should.be.ok res.should =~ /ruby/ end specify "does not allow directory traversal" do res = Rack::MockRequest.new(Rack::Lint.new(Rack::File.new(DOCROOT))). get("/cgi/../test") res.should.be.forbidden end specify "404s if it can't find the file" do res = Rack::MockRequest.new(Rack::Lint.new(Rack::File.new(DOCROOT))). get("/cgi/blubb") res.should.be.not_found end end
Version data entries
3 entries across 3 versions & 3 rubygems
Version | Path |
---|---|
technomancy-rack-0.3.0 | test/spec_rack_file.rb |
rack-0.3.0 | test/spec_rack_file.rb |
sinatra-0.2.2 | vendor/rack/test/spec_rack_file.rb |