1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix the ActionController::TestCase#process parameters serialization

This commit is contained in:
Jean Boussier 2020-06-23 12:28:21 +02:00
parent b91daea9ff
commit a2a97c39d3
2 changed files with 7 additions and 16 deletions

View file

@ -74,21 +74,14 @@ module ActionController
non_path_parameters = {}
path_parameters = {}
if parameters[:format] == :json
parameters = JSON.load(JSON.dump(parameters))
query_string_keys = query_string_keys.map(&:to_s)
end
parameters.each do |key, value|
if query_string_keys.include?(key)
non_path_parameters[key] = value
else
unless parameters["format"] == "json"
if value.is_a?(Array)
value = value.map(&:to_param)
else
value = value.to_param
end
if value.is_a?(Array)
value = value.map(&:to_param)
else
value = value.to_param
end
path_parameters[key] = value

View file

@ -766,11 +766,9 @@ module ActionDispatch
end
route_name = options.delete :use_route
path = path_for(options, route_name, [])
uri = URI.parse(path)
params = Rack::Utils.parse_nested_query(uri.query).symbolize_keys
[uri.path, params.keys]
generator = generate(route_name, options, recall)
path_info = path_for(options, route_name, [])
[URI(path_info).path, generator.params.except(:_recall).keys]
end
def generate(route_name, options, recall = {}, method_name = nil)