37c6fa71e61f6770fc1b09628c11e1363cd49509
[unicorn.git] / t / t0005-working_directory_app.rb.sh
blob37c6fa71e61f6770fc1b09628c11e1363cd49509
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 [ 200, [%w(Content-Type text/plain), %w(Content-Length 2)], %w(HI) ]
15 end
16 end
17 EOF
18 # the whole point of this exercise
19 echo "working_directory '$t_pfx.app'" >> $unicorn_config
20 cd /
21 unicorn -D -c $unicorn_config -I. fooapp.rb
22 unicorn_wait_start
25 t_begin "hit with curl" && {
26 body=$(curl -sSf http://$listen/)
29 t_begin "killing succeeds" && {
30 kill $unicorn_pid
33 t_begin "response body expected" && {
34 test x"$body" = xHI
37 t_done