diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-20 14:55:13 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-20 14:55:13 +0000 |
commit | dfed3d309e26c11ba4132aaf4c3cd25ad3b2c905 (patch) | |
tree | c1310189b961850f154406b4fd9ef72ffaefb1ac /actionpack/test/controller | |
parent | 93f7cb2a80b53d38eb01aaeade8f5c8bf13090f2 (diff) | |
download | rails-dfed3d309e26c11ba4132aaf4c3cd25ad3b2c905.tar.gz rails-dfed3d309e26c11ba4132aaf4c3cd25ad3b2c905.tar.bz2 rails-dfed3d309e26c11ba4132aaf4c3cd25ad3b2c905.zip |
A few missing files
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@468 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/raw_post_test.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/actionpack/test/controller/raw_post_test.rb b/actionpack/test/controller/raw_post_test.rb new file mode 100644 index 0000000000..98dc7f6ba7 --- /dev/null +++ b/actionpack/test/controller/raw_post_test.rb @@ -0,0 +1,31 @@ +require 'test/unit' +require 'cgi' +require 'stringio' +require File.dirname(__FILE__) + '/../../lib/action_controller/cgi_ext/raw_post_data_fix' + +class RawPostDataTest < Test::Unit::TestCase + def setup + ENV['REQUEST_METHOD'] = 'POST' + ENV['CONTENT_TYPE'] = '' + ENV['CONTENT_LENGTH'] = '0' + end + + def test_raw_post_data + process_raw "action=create_customer&full_name=David%20Heinemeier%20Hansson&customerId=1" + end + + private + def process_raw(query_string) + old_stdin = $stdin + begin + $stdin = StringIO.new(query_string.dup) + ENV['CONTENT_LENGTH'] = $stdin.size.to_s + CGI.new + assert_not_nil ENV['RAW_POST_DATA'] + assert ENV['RAW_POST_DATA'].frozen? + assert_equal query_string, ENV['RAW_POST_DATA'] + ensure + $stdin = old_stdin + end + end +end |