tests: extra working_directory integration cases
[unicorn.git] / t / t0303-rails3-alt-working_directory_config.ru.sh
blobb6fe5e7833f03299b2006c1a59f754c36a612f93
1 #!/bin/sh
2 if test -n "$RBX_SKIP"
3 then
4 echo "$0 is broken under Rubinius for now"
5 exit 0
6 fi
7 . ./test-rails3.sh
9 t_plan 5 "Rails 3 (beta) inside alt working_directory (w/ config.ru)"
11 t_begin "setup and start" && {
12 unicorn_setup
13 rtmpfiles unicorn_config_tmp usock
14 rm -f $usock
15 rails3_app=$(cd rails3-app && pwd)
16 rm -rf $t_pfx.app
17 mkdir $t_pfx.app
18 cd $t_pfx.app
19 ( cd $rails3_app && tar cf - . ) | tar xf -
20 $RAKE db:sessions:create
21 $RAKE db:migrate
22 unicorn_setup
23 rm $pid
25 echo "#\\--daemonize --host $host --port $port -l $usock" \
26 >> $t_pfx.app/config.ru
28 # we have --host/--port in config.ru instead
29 grep -v ^listen $unicorn_config |
30 grep -v ^pid > $unicorn_config_tmp
31 echo "working_directory '$t_pfx.app'" >> $unicorn_config_tmp
32 cd /
33 unicorn_rails -c $unicorn_config_tmp
36 t_begin "pids in the right place" && {
37 if test -e $pid
38 then
39 die "pid=$pid not expected"
42 unicorn_rails_pid="$t_pfx.app/tmp/pids/unicorn.pid"
43 unicorn_pid=$(cat $unicorn_rails_pid)
46 t_begin "static file serving works" && {
47 test x"$(curl -sSf http://$listen/x.txt)" = xHELLO
50 t_begin "socket created" && {
51 test -S $usock
54 t_begin "killing succeeds" && {
55 kill $unicorn_pid
58 t_done