diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-06-03 23:01:20 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-06-03 23:01:20 +0000 |
commit | e687ede9cd390b09bf1e87c6de18924ec57ff3c3 (patch) | |
tree | c08e580f888dc3d8db9e1051602f64254ac705f6 /t/t0300-rails3-basic.sh | |
parent | 8e55e561a1bcba57bf429c9c2111ec5351fcb1b3 (diff) | |
download | unicorn-e687ede9cd390b09bf1e87c6de18924ec57ff3c3.tar.gz |
We'll be switching to Isolate and shell-based tests since the old test/unit-based Rails test was basically a shell script written in Ruby.
Diffstat (limited to 't/t0300-rails3-basic.sh')
-rwxr-xr-x | t/t0300-rails3-basic.sh | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/t/t0300-rails3-basic.sh b/t/t0300-rails3-basic.sh new file mode 100755 index 0000000..ebc6317 --- /dev/null +++ b/t/t0300-rails3-basic.sh @@ -0,0 +1,55 @@ +#!/bin/sh +RAILS_VERSION=${RAILS_VERSION-3.0.0.beta3} + +. ./test-lib.sh + +case $RUBY_VERSION in +1.8.7|1.9.2) ;; +*) + t_info "RUBY_VERSION=$RUBY_VERSION unsupported for Rails 3" + exit 0 + ;; +esac + +arch_gems=../tmp/isolate/ruby-$RUBY_VERSION/gems +rails_gems=../tmp/isolate/rails-$RAILS_VERSION/gems +rails_bin="$rails_gems/rails-$RAILS_VERSION/bin/rails" +test -d "$arch_gems" || die "$arch_gems non existent, run '$RAKE isolate'" +test -d "$rails_gems" || die "$rails_gems non existent, run '$RAKE isolate'" +test -x "$rails_bin" || die "$rails_bin not found, run '$RAKE isolate'" + +for i in $arch_gems/*-* $rails_gems/*-* +do + if test -d $i/lib + then + RUBYLIB=$(cd $i/lib && pwd):$RUBYLIB + fi +done + +export RUBYLIB + +t_plan 3 "Rails 3 (beta) tests" + +t_begin "setup and start" && { + rails3_app=$(cd rails3-app && pwd) + rm -rf $t_pfx.app + mkdir $t_pfx.app + cd $t_pfx.app + ( cd $rails3_app && tar cf - . ) | tar xf - + $RAKE db:sessions:create + $RAKE db:migrate + unicorn_setup + unicorn -D -c $unicorn_config + unicorn_wait_start +} + +# add more tests here +t_begin "hit with curl" && { + curl -v http://$listen/ || : +} + +t_begin "killing succeeds" && { + kill $unicorn_pid +} + +t_done |