From 314ac0cd572ff9618997f8fd61ed381985c3a9cb Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 10 Jul 2015 11:29:13 -0700 Subject: call the `path_parameters=` setter rather than rely on mutations We should call the setter on `path_parameters` so that we know the hash will only contain the values that we've set. --- actionpack/lib/action_controller/test_case.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 3045b7f0c3..afd15b8630 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -46,6 +46,7 @@ module ActionController parameters = parameters.symbolize_keys extra_keys = routes.extra_keys(parameters.merge(:controller => controller_path, :action => action)) non_path_parameters = {} + path_parameters = {} parameters.each do |key, value| if extra_keys.include?(key) || key == :action || key == :controller @@ -99,12 +100,13 @@ module ActionController path_parameters[:controller] = controller_path path_parameters[:action] = action + self.path_parameters = path_parameters + # Clear the combined params hash in case it was already referenced. @env.delete("action_dispatch.request.parameters") # Clear the filter cache variables so they're not stale @filtered_parameters = @filtered_env = @filtered_path = nil - end ENCODER = Class.new do -- cgit v1.2.3