about summary refs log tree commit homepage
path: root/test/rails/app-2.2.2/app/controllers/foo_controller.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-04-01 01:43:44 -0700
committerEric Wong <normalperson@yhbt.net>2009-04-01 01:43:44 -0700
commitef9a2f05f3e14455dc70a5e0f68b0cf317a8709c (patch)
tree7d3d3831c66d99a2235d6c0ff9b1159f4238b164 /test/rails/app-2.2.2/app/controllers/foo_controller.rb
parentb2569b344d61a7d26033aeb6198d23f99d2e7f3e (diff)
downloadunicorn-ef9a2f05f3e14455dc70a5e0f68b0cf317a8709c.tar.gz
Additional tests for Rails have been added

 * cookies and sessions
 * POST requests
 * POST requests with multipart uploads
 * 404 handling
 * static file serving
 * cached static file serving
  (resources with ";" caching in some old 1.2.x version
   not yet tested)
Diffstat (limited to 'test/rails/app-2.2.2/app/controllers/foo_controller.rb')
-rw-r--r--test/rails/app-2.2.2/app/controllers/foo_controller.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/rails/app-2.2.2/app/controllers/foo_controller.rb b/test/rails/app-2.2.2/app/controllers/foo_controller.rb
index 7602947..8d877d1 100644
--- a/test/rails/app-2.2.2/app/controllers/foo_controller.rb
+++ b/test/rails/app-2.2.2/app/controllers/foo_controller.rb
@@ -1,5 +1,34 @@
+require 'digest/sha1'
 class FooController < ApplicationController
   def index
     render :text => "FOO\n"
   end
+
+  def xcookie
+    cookies["foo"] = "cookie #$$"
+    render :text => ""
+  end
+
+  def xnotice
+    flash[:notice] = "session #$$"
+    render :text => ""
+  end
+
+  def xpost
+    if request.post?
+      digest = Digest::SHA1.new
+      out = "params: #{params.inspect}\n"
+      if file = params[:file]
+        loop do
+          buf = file.read(4096) or break
+          digest.update(buf)
+        end
+        out << "sha1: #{digest.to_s}\n"
+      end
+      headers['content-type'] = 'text/plain'
+      render :text => out
+    else
+      render :status => 403, :text => "need post\n"
+    end
+  end
 end