c93f24866dafd3c12c8f7c38911838ddb74dcafd
[unicorn.git] / t / t0304-rails3-alt-working_directory_no_embed_cli.sh
blobc93f24866dafd3c12c8f7c38911838ddb74dcafd
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 usocket
9 if test -e $usocket
10 then
11 die "unexpected $usocket"
13 rails3_app=$(cd rails3-app && pwd)
14 rm -rf $t_pfx.app
15 mkdir $t_pfx.app
16 cd $t_pfx.app
17 ( cd $rails3_app && tar cf - . ) | tar xf -
18 $RAKE db:sessions:create
19 $RAKE db:migrate
20 unicorn_setup
21 rm $pid
23 grep -v ^pid $unicorn_config > $unicorn_config_tmp
24 echo "working_directory '$t_pfx.app'" >> $unicorn_config_tmp
25 cd /
26 unicorn_rails -c $unicorn_config_tmp \
27 --daemonize --host $host --port $port -l $usocket
30 t_begin "pids in the right place" && {
31 if test -e $pid
32 then
33 die "pid=$pid not expected"
36 unicorn_rails_pid="$t_pfx.app/tmp/pids/unicorn.pid"
37 unicorn_pid=$(cat $unicorn_rails_pid)
40 t_begin "static file serving works" && {
41 test x"$(curl -sSf http://$listen/x.txt)" = xHELLO
44 t_begin "socket created" && {
45 test -S $usocket
48 t_begin "killing succeeds" && {
49 kill $unicorn_pid
52 t_done