about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-06-10 19:11:01 -0700
committerEric Wong <normalperson@yhbt.net>2010-06-10 19:12:23 -0700
commiteb57310d6130e5d2ce146126a17346f9cba6c49e (patch)
tree4db2a15c33ef92f7fb4f3d703f2024e854af2d7b /t
parent454293f71376a3601e5e087d20a7d8420fdb3260 (diff)
downloadunicorn-eb57310d6130e5d2ce146126a17346f9cba6c49e.tar.gz
Diffstat (limited to 't')
-rwxr-xr-xt/t0005-working_directory_app.rb.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/t/t0005-working_directory_app.rb.sh b/t/t0005-working_directory_app.rb.sh
new file mode 100755
index 0000000..ba43387
--- /dev/null
+++ b/t/t0005-working_directory_app.rb.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+. ./test-lib.sh
+
+t_plan 4 "fooapp.rb inside alt working_directory"
+
+t_begin "setup and start" && {
+        unicorn_setup
+        rm -rf $t_pfx.app
+        mkdir $t_pfx.app
+
+        cat > $t_pfx.app/fooapp.rb <<\EOF
+class Fooapp
+  def self.call(env)
+    [ 200, [%w(Content-Type text/plain), %w(Content-Length 2)], %w(HI) ]
+  end
+end
+EOF
+        # the whole point of this exercise
+        echo "working_directory '$t_pfx.app'" >> $unicorn_config
+        cd /
+        unicorn -D -c $unicorn_config fooapp.rb
+        unicorn_wait_start
+}
+
+t_begin "hit with curl" && {
+        body=$(curl -sSf http://$listen/)
+}
+
+t_begin "killing succeeds" && {
+        kill $unicorn_pid
+}
+
+t_begin "response body expected" && {
+        test x"$body" = xHI
+}
+
+t_done