aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/cgi_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-06-02 06:30:23 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-06-02 06:30:23 +0000
commit8cdf9126d3c3174cad74f8ae4a913f1940d3474a (patch)
tree62cff073130d1dcd3036210b7d1c5322233f84ef /actionpack/test/controller/cgi_test.rb
parent6dea52c54e272b4592d1d157c8626003b03fcac1 (diff)
downloadrails-8cdf9126d3c3174cad74f8ae4a913f1940d3474a.tar.gz
rails-8cdf9126d3c3174cad74f8ae4a913f1940d3474a.tar.bz2
rails-8cdf9126d3c3174cad74f8ae4a913f1940d3474a.zip
Rewind readable CGI params so others may reread them (such as CGI::Session when passing the session id in a multipart form). Closes #210.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4410 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller/cgi_test.rb')
-rwxr-xr-xactionpack/test/controller/cgi_test.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/actionpack/test/controller/cgi_test.rb b/actionpack/test/controller/cgi_test.rb
index 0415a1384c..f0af5b4ed3 100755
--- a/actionpack/test/controller/cgi_test.rb
+++ b/actionpack/test/controller/cgi_test.rb
@@ -303,13 +303,21 @@ class MultipartCGITest < Test::Unit::TestCase
assert_equal 19756, params['files'].size
end
+ # Rewind readable cgi params so others may reread them (such as CGI::Session
+ # when passing the session id in a multipart form).
+ def test_multipart_param_rewound
+ params = process('text_file')
+ assert_equal 'bar', @cgi.params['foo'][0].read
+ end
+
private
def process(name)
old_stdin = $stdin
File.open(File.join(FIXTURE_PATH, name), 'rb') do |file|
ENV['CONTENT_LENGTH'] = file.stat.size.to_s
$stdin = file
- CGIMethods.parse_request_parameters CGI.new.params
+ @cgi = CGI.new
+ CGIMethods.parse_request_parameters @cgi.params
end
ensure
$stdin = old_stdin