aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/test_case.rb
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2011-08-23 11:07:37 +0100
committerAndrew White <andyw@pixeltrix.co.uk>2011-08-23 11:07:37 +0100
commit14cf4b2e353f923155aab1ae0eaafed3c2924b12 (patch)
treee7e89dcf22b2dd76a31beb0205fcbec0ace57295 /actionpack/lib/action_controller/test_case.rb
parent7079701e5bfe3b8d6e8339f2cc4964e3608f1ffe (diff)
downloadrails-14cf4b2e353f923155aab1ae0eaafed3c2924b12.tar.gz
rails-14cf4b2e353f923155aab1ae0eaafed3c2924b12.tar.bz2
rails-14cf4b2e353f923155aab1ae0eaafed3c2924b12.zip
Don't modify params in place - fixes #2624
Diffstat (limited to 'actionpack/lib/action_controller/test_case.rb')
-rw-r--r--actionpack/lib/action_controller/test_case.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index c8cf04bb69..a38e5a46da 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -401,9 +401,7 @@ module ActionController
def paramify_values(hash_or_array_or_value)
case hash_or_array_or_value
when Hash
- hash_or_array_or_value.each do |key, value|
- hash_or_array_or_value[key] = paramify_values(value)
- end
+ Hash[hash_or_array_or_value.map{|key, value| [key, paramify_values(value)] }]
when Array
hash_or_array_or_value.map {|i| paramify_values(i)}
when Rack::Test::UploadedFile
@@ -416,7 +414,7 @@ module ActionController
def process(action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
# Ensure that numbers and symbols passed as params are converted to
# proper params, as is the case when engaging rack.
- paramify_values(parameters)
+ parameters = paramify_values(parameters)
# Sanity check for required instance variables so we can give an
# understandable error message.
@@ -450,7 +448,7 @@ module ActionController
@controller.params.merge!(parameters)
build_request_uri(action, parameters)
@controller.class.class_eval { include Testing }
- @controller.recycle!
+ @controller.recycle!
@controller.process_with_new_base_test(@request, @response)
@assigns = @controller.respond_to?(:view_assigns) ? @controller.view_assigns : {}
@request.session.delete('flash') if @request.session['flash'].blank?