test: rails 3: automatically run isolate if needed
[unicorn.git] / t / t0300-rails3-basic.sh
blobc20ceef24a6648455cfe17f1d963c5c0562b8845
1 #!/bin/sh
2 RAILS_VERSION=${RAILS_VERSION-3.0.0.beta3}
4 . ./test-lib.sh
6 case $RUBY_VERSION in
7 1.8.7|1.9.2) ;;
8 *)
9 t_info "RUBY_VERSION=$RUBY_VERSION unsupported for Rails 3"
10 exit 0
12 esac
14 arch_gems=../tmp/isolate/ruby-$RUBY_VERSION/gems
15 rails_gems=../tmp/isolate/rails-$RAILS_VERSION/gems
16 rails_bin="$rails_gems/rails-$RAILS_VERSION/bin/rails"
17 if ! test -d "$arch_gems" || ! test -d "$rails_gems" || ! test -x "$rails_bin"
18 then
19 ( cd ../ && $RAKE isolate )
22 for i in $arch_gems/*-* $rails_gems/*-*
24 if test -d $i/lib
25 then
26 RUBYLIB=$(cd $i/lib && pwd):$RUBYLIB
28 done
30 export RUBYLIB
32 t_plan 3 "Rails 3 (beta) tests"
34 t_begin "setup and start" && {
35 rails3_app=$(cd rails3-app && pwd)
36 rm -rf $t_pfx.app
37 mkdir $t_pfx.app
38 cd $t_pfx.app
39 ( cd $rails3_app && tar cf - . ) | tar xf -
40 $RAKE db:sessions:create
41 $RAKE db:migrate
42 unicorn_setup
43 unicorn -D -c $unicorn_config
44 unicorn_wait_start
47 # add more tests here
48 t_begin "hit with curl" && {
49 curl -v http://$listen/ || :
52 t_begin "killing succeeds" && {
53 kill $unicorn_pid
56 t_done