tests: extra working_directory integration cases
[unicorn.git] / t / t0304-rails3-alt-working_directory_no_embed_cli.sh
blob27676cb810cbf07e6d76a728fedf6f3d4617573b
1 #!/bin/sh
2 . ./test-rails3.sh
4 t_plan 5 "Rails 3 (beta) inside alt working_directory (no embedded switches)"
6 t_begin "setup and start" && {
7 unicorn_setup
8 rtmpfiles unicorn_config_tmp usock
9 rm -f $usock
10 rails3_app=$(cd rails3-app && pwd)
11 rm -rf $t_pfx.app
12 mkdir $t_pfx.app
13 cd $t_pfx.app
14 ( cd $rails3_app && tar cf - . ) | tar xf -
15 $RAKE db:sessions:create
16 $RAKE db:migrate
17 unicorn_setup
18 rm $pid
20 grep -v ^pid $unicorn_config > $unicorn_config_tmp
21 echo "working_directory '$t_pfx.app'" >> $unicorn_config_tmp
22 cd /
23 unicorn_rails -c $unicorn_config_tmp \
24 --daemonize --host $host --port $port -l $usock
27 t_begin "pids in the right place" && {
28 if test -e $pid
29 then
30 die "pid=$pid not expected"
33 unicorn_rails_pid="$t_pfx.app/tmp/pids/unicorn.pid"
34 unicorn_pid=$(cat $unicorn_rails_pid)
37 t_begin "static file serving works" && {
38 test x"$(curl -sSf http://$listen/x.txt)" = xHELLO
41 t_begin "socket created" && {
42 test -S $usock
45 t_begin "killing succeeds" && {
46 kill $unicorn_pid
49 t_done