diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-16 03:15:12 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-16 03:15:12 +0000 |
commit | 275ea6de499c009e51fbe4c1abcfa4f50bdfeb12 (patch) | |
tree | 0fe9223dd08fc18d77f4662e6bbfd5f6a01acbcb /actionpack/test | |
parent | c3c69d90626dd5ac16231b1d53615547df678f76 (diff) | |
download | rails-275ea6de499c009e51fbe4c1abcfa4f50bdfeb12.tar.gz rails-275ea6de499c009e51fbe4c1abcfa4f50bdfeb12.tar.bz2 rails-275ea6de499c009e51fbe4c1abcfa4f50bdfeb12.zip |
Added TestRequest#raw_post that simulate raw_post from CgiRequest (closes #3042) [francois.beausoleil@gmail.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3888 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/test_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index dcb16841ae..25c514d5a3 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -8,6 +8,11 @@ class TestTest < Test::Unit::TestCase render :text => 'ignore me' end + def render_raw_post + raise Test::Unit::AssertionFailedError, "#raw_post is blank" if request.raw_post.blank? + render :text => request.raw_post + end + def test_params render :text => params.inspect end @@ -44,6 +49,10 @@ HTML def test_remote_addr render :text => (request.remote_addr || "not specified") end + + def rescue_action(e) + raise e + end end def setup @@ -57,6 +66,14 @@ HTML ActionController::Routing::Routes.reload end + def test_raw_post_handling + params = {:page => {:name => 'page name'}, 'some key' => 123} + get :render_raw_post, params.dup + + raw_post = params.map {|k,v| [CGI::escape(k.to_s), CGI::escape(v.to_s)].join('=')}.sort.join('&') + assert_equal raw_post, @response.body + end + def test_process_without_flash process :set_flash assert_equal '><', flash['test'] |