unicorn 4.6.0pre1 - hijacking support
[unicorn.git] / t / t0005-working_directory_app.rb.sh
blob0fbab4fc00a21452673efb8a2c2811e29d0099ae
1 #!/bin/sh
2 . ./test-lib.sh
4 t_plan 4 "fooapp.rb inside alt working_directory"
6 t_begin "setup and start" && {
7 unicorn_setup
8 rm -rf $t_pfx.app
9 mkdir $t_pfx.app
11 cat > $t_pfx.app/fooapp.rb <<\EOF
12 class Fooapp
13 def self.call(env)
14 # Rack::Lint in 1.5.0 requires headers to be a hash
15 h = [%w(Content-Type text/plain), %w(Content-Length 2)]
16 h = Rack::Utils::HeaderHash.new(h)
17 [ 200, h, %w(HI) ]
18 end
19 end
20 EOF
21 # the whole point of this exercise
22 echo "working_directory '$t_pfx.app'" >> $unicorn_config
23 cd /
24 unicorn -D -c $unicorn_config -I. fooapp.rb
25 unicorn_wait_start
28 t_begin "hit with curl" && {
29 body=$(curl -sSf http://$listen/)
32 t_begin "killing succeeds" && {
33 kill $unicorn_pid
36 t_begin "response body expected" && {
37 test x"$body" = xHI
40 t_done