Sha256: 98287bfcf912c10a2e3732aa823e0dca82f07fb61d692230201869be56727b1f
Contents?: true
Size: 1.77 KB
Versions: 1
Compression:
Stored size: 1.77 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') require 'rack/handler/jetty' require 'rack/lint' describe Rack::Handler::Jetty do include TestRequest::Helpers before :all do @server = Rack::Handler::Jetty.new(Rack::Lint.new(TestRequest.new), :Host => @host='0.0.0.0',:Port => @port=9204) Thread.new do @server.run end Thread.pass until @server.running? end after :all do @server.stop Thread.pass until @server.stopped? end it "should respond to a simple get request" do GET "/" status.should == 200 end it "should have CGI headers on GET" do GET("/") response["REQUEST_METHOD"].should == "GET" response["SCRIPT_NAME"].should == '' response["PATH_INFO"].should == "/" response["QUERY_STRING"].should == "" response["test.postdata"].should == "" GET("/test/foo?quux=1") response["REQUEST_METHOD"].should == "GET" response["SCRIPT_NAME"].should == '' response["REQUEST_URI"].should == "/test/foo" response["PATH_INFO"].should == "/test/foo" response["QUERY_STRING"].should == "quux=1" end it "should have CGI headers on POST" do POST("/", {"rack-form-data" => "23"}, {'X-test-header' => '42'}) status.should == 200 response["REQUEST_METHOD"].should == "POST" response["REQUEST_URI"].should == "/" response["QUERY_STRING"].should == "" response["HTTP_X_TEST_HEADER"].should == "42" response["test.postdata"].should == "rack-form-data=23" end it "should support HTTP auth" do GET("/test", {:user => "ruth", :passwd => "secret"}) response["HTTP_AUTHORIZATION"].should == "Basic cnV0aDpzZWNyZXQ=" end it "should set status" do GET("/test?secret") status.should == 403 response["rack.url_scheme"].should == "http" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rack-jetty-0.1.0 | spec/rack_handler_jetty_spec.rb |