Sha256: 818435b31f2ac7f81feb2f67dc235608690c461eacac9bb9daec21bfc11b213e

Contents?: true

Size: 1.19 KB

Versions: 50

Compression:

Stored size: 1.19 KB

Contents

shared_examples_for "HelloWorld WSGI application" do
	after :each do
		File.unlink("#{@stub.app_root}/passenger_wsgi.pyc") rescue nil
	end
	
	it "is possible to fetch static assets" do
		get('/wsgi-snake.jpg').should == @stub.public_file('wsgi-snake.jpg')
	end
	
	it "is possible to GET a regular WSGI page" do
		get('/').should =~ /Hello World/
	end
	
	it "supports restarting via restart.txt" do
		get('/').should =~ /Hello World/
		
		code = %q{
			def application(env, start_response):
				start_response('200 OK', [('Content-Type', 'text/html')])
				return ["changed"]
		}.gsub(/^\t\t\t/, '')
		
		File.write("#{@stub.app_root}/passenger_wsgi.py", code)
		File.new("#{@stub.app_root}/tmp/restart.txt", "w").close
		File.utime(2, 2, "#{@stub.app_root}/tmp/restart.txt")
		get('/').should == "changed"
	end
	
	if Process.uid == 0
		it "runs as an unprivileged user" do
			File.prepend("#{@stub.app_root}/passenger_wsgi.py",
				"file('foo.txt', 'w').close()\n")
			File.new("#{@stub.app_root}/tmp/restart.txt", "w").close
			File.utime(1, 1, "#{@stub.app_root}/tmp/restart.txt")
			get('/')
			stat = File.stat("#{@stub.app_root}/foo.txt")
			stat.uid.should_not == 0
			stat.gid.should_not == 0
		end
	end
end

Version data entries

50 entries across 50 versions & 7 rubygems

Version Path
passenger-3.0.21 test/integration_tests/hello_world_wsgi_spec.rb
passenger-3.9.2.beta test/integration_tests/hello_world_wsgi_spec.rb
passenger-3.0.19 test/integration_tests/hello_world_wsgi_spec.rb
passenger-3.0.18 test/integration_tests/hello_world_wsgi_spec.rb
passenger-3.9.1.beta test/integration_tests/hello_world_wsgi_spec.rb
passenger-3.0.17 test/integration_tests/hello_world_wsgi_spec.rb
passenger-3.0.15 test/integration_tests/hello_world_wsgi_spec.rb
passenger-3.0.14 test/integration_tests/hello_world_wsgi_spec.rb
passenger-3.0.13 test/integration_tests/hello_world_wsgi_spec.rb
passenger-3.0.12 test/integration_tests/hello_world_wsgi_spec.rb
yspassenger-3.0.12 test/integration_tests/hello_world_wsgi_spec.rb
passenger-3.0.11 test/integration_tests/hello_world_wsgi_spec.rb
passenger-3.0.10 test/integration_tests/hello_world_wsgi_spec.rb
vanity-1.7.1 vendor/ruby/1.9.1/gems/passenger-2.2.15/test/integration_tests/hello_world_wsgi_spec.rb
passenger-3.0.9 test/integration_tests/hello_world_wsgi_spec.rb
passenger-3.0.8 test/integration_tests/hello_world_wsgi_spec.rb
passenger-3.0.7 test/integration_tests/hello_world_wsgi_spec.rb
passenger-3.0.6 test/integration_tests/hello_world_wsgi_spec.rb
passenger-3.0.5 test/integration_tests/hello_world_wsgi_spec.rb
passenger-3.0.4 test/integration_tests/hello_world_wsgi_spec.rb