File: cgi_environment_spec.rb

package info (click to toggle)
ruby-passenger 3.0.13debian-1%2Bdeb7u2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 15,920 kB
  • sloc: cpp: 99,104; ruby: 18,098; ansic: 9,846; sh: 8,632; python: 141; makefile: 30
file content (36 lines) | stat: -rw-r--r-- 1,601 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
shared_examples_for "CGI environment variables compliance" do
	specify "REQUEST_URI contains the request URI including query string" do
		cgi_envs = get('/welcome/cgi_environment?foo=escaped%20string')
		cgi_envs.should include("REQUEST_URI = #{@base_uri}/welcome/cgi_environment?foo=escaped%20string\n")
	end
	
	specify "REQUEST_URI contains the original escaped URI" do
		cgi_envs = get('/welcome/cgi_environment/%C3%BC?foo=escaped%20string')
		cgi_envs.downcase.should include("request_uri = #{@base_uri}/welcome/cgi_environment/%c3%bc?foo=escaped%20string\n")
	end
	
	specify "PATH_INFO contains the request URI without the base URI and without the query string" do
		cgi_envs = get('/welcome/cgi_environment?foo=escaped%20string')
		cgi_envs.should include("PATH_INFO = /welcome/cgi_environment\n")
	end
	
	specify "PATH_INFO contains the original escaped URI" do
		cgi_envs = get('/welcome/cgi_environment/%C3%BC')
		cgi_envs.downcase.should include("path_info = /welcome/cgi_environment/%c3%bc\n")
	end
	
	specify "QUERY_STRING contains the query string" do
		cgi_envs = get('/welcome/cgi_environment?foo=escaped%20string')
		cgi_envs.should include("QUERY_STRING = foo=escaped%20string\n")
	end
	
	specify "QUERY_STRING must be present even when there's no query string" do
		cgi_envs = get('/welcome/cgi_environment')
		cgi_envs.should include("QUERY_STRING = \n")
	end
	
	specify "SCRIPT_NAME contains the base URI, or the empty string if the app is deployed on the root URI" do
		cgi_envs = get('/welcome/cgi_environment')
		cgi_envs.should include("SCRIPT_NAME = #{@base_uri}\n")
	end
end