diff options
author | Peter Marklund <peter_marklund@fastmail.fm> | 2009-03-24 10:37:57 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-03-24 10:54:15 -0500 |
commit | 8fa4275a72c334fe945dada6113fa0153ca28c87 (patch) | |
tree | 2602e3f2a4f5120667ce64f1ff45e69babfe77df /actionpack | |
parent | 03700b4f0131059f3e848324ad42f2b53f12d8c9 (diff) | |
download | rails-8fa4275a72c334fe945dada6113fa0153ca28c87.tar.gz rails-8fa4275a72c334fe945dada6113fa0153ca28c87.tar.bz2 rails-8fa4275a72c334fe945dada6113fa0153ca28c87.zip |
Reset request_parameters in TestRequest#recycle! to avoid multiple posts clobbering each other [#2271 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/test_process.rb | 1 | ||||
-rw-r--r-- | actionpack/test/controller/test_test.rb | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb index 9dd09c30b4..94c57667ec 100644 --- a/actionpack/lib/action_controller/test_process.rb +++ b/actionpack/lib/action_controller/test_process.rb @@ -110,6 +110,7 @@ module ActionController #:nodoc: end def recycle! + @env["action_controller.request.request_parameters"] = {} self.query_parameters = {} self.path_parameters = {} @headers, @request_method, @accepts, @content_type = nil, nil, nil, nil diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index 65c894c2e7..3924b282d4 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -515,6 +515,14 @@ XML assert_nil @request.instance_variable_get("@request_method") end + def test_params_reset_after_post_request + post :no_op, :foo => "bar" + assert_equal "bar", @request.params[:foo] + @request.recycle! + post :no_op + assert @request.params[:foo].blank? + end + %w(controller response request).each do |variable| %w(get post put delete head process).each do |method| define_method("test_#{variable}_missing_for_#{method}_raises_error") do |