From ef9a2f05f3e14455dc70a5e0f68b0cf317a8709c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 1 Apr 2009 01:43:44 -0700 Subject: Add more tests for Rails 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) --- .../app-2.2.2/app/controllers/foo_controller.rb | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test/rails/app-2.2.2/app/controllers/foo_controller.rb') 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 -- cgit v1.2.3-24-ge0c7