aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2014-01-27 09:08:56 +0000
committerAndrew White <andyw@pixeltrix.co.uk>2014-01-27 13:30:28 +0000
commit31616068032beb537768787ff3a206b062eb192e (patch)
treec78d327d742a844a2ce4f0598fa8aa320986d76c /actionpack/lib/action_controller
parent9673d5df2764f8a2f84fc739b480f3040926c0cd (diff)
downloadrails-31616068032beb537768787ff3a206b062eb192e.tar.gz
rails-31616068032beb537768787ff3a206b062eb192e.tar.bz2
rails-31616068032beb537768787ff3a206b062eb192e.zip
Clear filtered request attributes between requests in tests
The request attributes filtered_parameters, filtered_env and filtered_path are memoized for performance reasons. However this can cause unusual behavior in tests where there are multiple calls to get, post, etc. Fixes #13803.
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/test_case.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index 5ed3d2ebc1..cf11ce1a9b 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -213,6 +213,9 @@ module ActionController
# 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
+
params = self.request_parameters.dup
%w(controller action only_path).each do |k|
params.delete(k)