Skip to content

Commit

Permalink
Move TestRequest to test/
Browse files Browse the repository at this point in the history
darcs-hash:20070228191254-4fc50-42c88e9d6f28ad0390f74ca1867af3da76ed7620.gz
  • Loading branch information
leahneukirchen committed Feb 28, 2007
1 parent b88db13 commit be41d90
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 30 deletions.
2 changes: 1 addition & 1 deletion test/cgi/test
Expand Up @@ -4,6 +4,6 @@
$: << File.join(File.dirname(__FILE__), "..", "..", "lib")

require 'rack'
require 'rack/testrequest'
require '../testrequest'

Rack::Handler::CGI.run(Rack::Lint.new(TestRequest.new))
2 changes: 1 addition & 1 deletion test/cgi/test.fcgi
Expand Up @@ -4,6 +4,6 @@
$: << File.join(File.dirname(__FILE__), "..", "..", "lib")

require 'rack'
require 'rack/testrequest'
require '../testrequest'

Rack::Handler::FastCGI.run(Rack::Lint.new(TestRequest.new))
2 changes: 1 addition & 1 deletion test/cgi/test.ru
Expand Up @@ -2,6 +2,6 @@
#\ -E deployment -I ~/projects/rack/lib
# -*- ruby -*-

require 'rack/testrequest'
require '../testrequest'

run TestRequest.new
2 changes: 1 addition & 1 deletion test/spec_rack_cgi.rb
@@ -1,5 +1,5 @@
require 'test/spec'
require 'rack/testrequest'
require 'testrequest'

pid = fork {
exec "cd #{File.join(File.dirname(__FILE__), 'cgi')} && lighttpd -D -f lighttpd.conf"
Expand Down
2 changes: 1 addition & 1 deletion test/spec_rack_fastcgi.rb
@@ -1,5 +1,5 @@
require 'test/spec'
require 'rack/testrequest'
require 'testrequest'

pid = fork {
exec "cd #{File.join(File.dirname(__FILE__), 'cgi')} && lighttpd -D -f lighttpd.conf"
Expand Down
2 changes: 1 addition & 1 deletion test/spec_rack_mongrel.rb
Expand Up @@ -2,7 +2,7 @@

require 'rack/handler/mongrel'
require 'rack/lint'
require 'rack/testrequest'
require 'testrequest'

Thread.abort_on_exception = true
$tcp_defer_accept_opts = nil
Expand Down
2 changes: 1 addition & 1 deletion test/spec_rack_webrick.rb
Expand Up @@ -2,7 +2,7 @@

require 'rack/handler/webrick'
require 'rack/lint'
require 'rack/testrequest'
require 'testrequest'

Thread.abort_on_exception = true

Expand Down
23 changes: 0 additions & 23 deletions lib/rack/testrequest.rb → test/testrequest.rb
Expand Up @@ -2,29 +2,6 @@
require 'net/http'

class TestRequest
TEST_ENV = {
"REQUEST_METHOD" => "GET",
"SERVER_NAME" => "example.org",
"SERVER_PORT" => "8080",
"QUERY_STRING" => "",
"rack.version" => [0,1],
"rack.input" => StringIO.new,
"rack.errors" => StringIO.new,
"rack.multithread" => true,
"rack.multiprocess" => true,
"rack.run_once" => false,
"rack.url_scheme" => "http",
"PATH_INFO" => "/",
}

def self.env(modifier)
e = TEST_ENV.dup
e.update modifier
e.delete_if { |k, v| v.nil? }
e
end


def call(env)
status = env["QUERY_STRING"] =~ /secret/ ? 403 : 200
env["test.postdata"] = env["rack.input"].read
Expand Down

0 comments on commit be41d90

Please sign in to comment.