PATH:
opt
/
alt
/
ruby23
/
lib64
/
ruby
/
gems
/
2.3.0
/
gems
/
rack-1.6.4
/
test
require 'rack/showstatus' require 'rack/lint' require 'rack/mock' require 'rack/utils' describe Rack::ShowStatus do def show_status(app) Rack::Lint.new Rack::ShowStatus.new(app) end should "provide a default status message" do req = Rack::MockRequest.new( show_status(lambda{|env| [404, {"Content-Type" => "text/plain", "Content-Length" => "0"}, []] })) res = req.get("/", :lint => true) res.should.be.not_found res.should.be.not.empty res["Content-Type"].should.equal("text/html") res.should =~ /404/ res.should =~ /Not Found/ end should "let the app provide additional information" do req = Rack::MockRequest.new( show_status( lambda{|env| env["rack.showstatus.detail"] = "gone too meta." [404, {"Content-Type" => "text/plain", "Content-Length" => "0"}, []] })) res = req.get("/", :lint => true) res.should.be.not_found res.should.be.not.empty res["Content-Type"].should.equal("text/html") res.should =~ /404/ res.should =~ /Not Found/ res.should =~ /too meta/ end should "escape error" do detail = "<script>alert('hi \"')</script>" req = Rack::MockRequest.new( show_status( lambda{|env| env["rack.showstatus.detail"] = detail [500, {"Content-Type" => "text/plain", "Content-Length" => "0"}, []] })) res = req.get("/", :lint => true) res.should.be.not.empty res["Content-Type"].should.equal("text/html") res.should =~ /500/ res.should.not.include detail res.body.should.include Rack::Utils.escape_html(detail) end should "not replace existing messages" do req = Rack::MockRequest.new( show_status( lambda{|env| [404, {"Content-Type" => "text/plain", "Content-Length" => "4"}, ["foo!"]] })) res = req.get("/", :lint => true) res.should.be.not_found res.body.should == "foo!" end should "pass on original headers" do headers = {"WWW-Authenticate" => "Basic blah"} req = Rack::MockRequest.new( show_status(lambda{|env| [401, headers, []] })) res = req.get("/", :lint => true) res["WWW-Authenticate"].should.equal("Basic blah") end should "replace existing messages if there is detail" do req = Rack::MockRequest.new( show_status( lambda{|env| env["rack.showstatus.detail"] = "gone too meta." [404, {"Content-Type" => "text/plain", "Content-Length" => "4"}, ["foo!"]] })) res = req.get("/", :lint => true) res.should.be.not_found res.should.be.not.empty res["Content-Type"].should.equal("text/html") res["Content-Length"].should.not.equal("4") res.should =~ /404/ res.should =~ /too meta/ res.body.should.not =~ /foo/ end end
[-] spec_fastcgi.rb
[edit]
[-] spec_session_pool.rb
[edit]
[-] spec_auth_basic.rb
[edit]
[-] spec_head.rb
[edit]
[-] spec_multipart.rb
[edit]
[-] spec_builder.rb
[edit]
[-] spec_config.rb
[edit]
[-] spec_recursive.rb
[edit]
[-] spec_runtime.rb
[edit]
[-] spec_server.rb
[edit]
[+]
multipart
[-] spec_commonlogger.rb
[edit]
[-] spec_nulllogger.rb
[edit]
[-] spec_file.rb
[edit]
[-] spec_rewindable_input.rb
[edit]
[+]
registering_handler
[-] spec_sendfile.rb
[edit]
[+]
unregistered_handler
[-] spec_mock.rb
[edit]
[+]
static
[-] spec_tempfile_reaper.rb
[edit]
[-] spec_content_type.rb
[edit]
[-] spec_urlmap.rb
[edit]
[-] spec_lint.rb
[edit]
[-] spec_methodoverride.rb
[edit]
[-] spec_session_memcache.rb
[edit]
[-] spec_utils.rb
[edit]
[-] spec_content_length.rb
[edit]
[-] spec_cgi.rb
[edit]
[-] spec_auth_digest.rb
[edit]
[-] spec_thin.rb
[edit]
[-] spec_showstatus.rb
[edit]
[-] spec_lock.rb
[edit]
[-] spec_mongrel.rb
[edit]
[-] spec_etag.rb
[edit]
[-] spec_chunked.rb
[edit]
[+]
..
[-] spec_request.rb
[edit]
[-] spec_body_proxy.rb
[edit]
[-] spec_static.rb
[edit]
[-] spec_cascade.rb
[edit]
[-] spec_showexceptions.rb
[edit]
[-] spec_session_abstract_id.rb
[edit]
[-] spec_directory.rb
[edit]
[+]
rackup
[-] spec_handler.rb
[edit]
[-] spec_version.rb
[edit]
[-] testrequest.rb
[edit]
[-] spec_conditionalget.rb
[edit]
[-] spec_logger.rb
[edit]
[-] spec_mime.rb
[edit]
[-] spec_response.rb
[edit]
[-] spec_webrick.rb
[edit]
[+]
cgi
[-] gemloader.rb
[edit]
[-] spec_deflater.rb
[edit]
[-] spec_session_cookie.rb
[edit]
[-] spec_lobster.rb
[edit]
[+]
builder