From 3f0c71c8524856c32bc056bdb38136b3d18f2aaf Mon Sep 17 00:00:00 2001 From: David Chelimsky Date: Sun, 22 May 2011 08:11:54 -0400 Subject: use to_param (and change method to name accordingly) - exclude Rack::Test::UploadedFile to pass existing tests. Are there any other types we're missing? --- actionpack/lib/action_controller/test_case.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 9c1f77ec91..639e24c995 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -395,25 +395,25 @@ module ActionController end alias xhr :xml_http_request - def stringify_values(hash_or_array_or_value) + 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] = stringify_values(value) + hash_or_array_or_value[key] = paramify_values(value) end when Array - hash_or_array_or_value.map {|i| stringify_values(i)} - when Numeric, Symbol - hash_or_array_or_value.to_s - else + hash_or_array_or_value.map {|i| paramify_values(i)} + when Rack::Test::UploadedFile hash_or_array_or_value + else + hash_or_array_or_value.to_param end end def process(action, parameters = nil, session = nil, flash = nil, http_method = 'GET') # Ensure that numbers and symbols passed as params are converted to - # strings, as is the case when engaging rack. - stringify_values(parameters) + # proper params, as is the case when engaging rack. + paramify_values(parameters) # Sanity check for required instance variables so we can give an # understandable error message. -- cgit v1.2.3