aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/request_test.rb
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2018-08-22 11:35:55 -0400
committerPeter Zhu <peter@peterzhu.ca>2018-08-22 15:54:26 -0400
commitce6166f3079e96836dcd93fc68f1618f53a1d1cc (patch)
treede26b00dbedf5cedc45659032a4297e93e62b8cb /actionpack/test/dispatch/request_test.rb
parent9136bb77a73a9374078f850af056225172f1f211 (diff)
downloadrails-ce6166f3079e96836dcd93fc68f1618f53a1d1cc.tar.gz
rails-ce6166f3079e96836dcd93fc68f1618f53a1d1cc.tar.bz2
rails-ce6166f3079e96836dcd93fc68f1618f53a1d1cc.zip
Update ParameterFilter to yield original parameters
Diffstat (limited to 'actionpack/test/dispatch/request_test.rb')
-rw-r--r--actionpack/test/dispatch/request_test.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb
index 84a2d1f69e..0ac8713527 100644
--- a/actionpack/test/dispatch/request_test.rb
+++ b/actionpack/test/dispatch/request_test.rb
@@ -1078,10 +1078,13 @@ class RequestParameterFilter < BaseRequestTest
filter_words << lambda { |key, value|
value.reverse! if key =~ /bargain/
}
+ filter_words << lambda { |key, value, original_params|
+ value.replace("world!") if original_params["barg"]["blah"] == "bar" && key == "hello"
+ }
parameter_filter = ActionDispatch::Http::ParameterFilter.new(filter_words)
- before_filter["barg"] = { :bargain => "gain", "blah" => "bar", "bar" => { "bargain" => { "blah" => "foo" } } }
- after_filter["barg"] = { :bargain => "niag", "blah" => "[FILTERED]", "bar" => { "bargain" => { "blah" => "[FILTERED]" } } }
+ before_filter["barg"] = { :bargain => "gain", "blah" => "bar", "bar" => { "bargain" => { "blah" => "foo", "hello" => "world" } } }
+ after_filter["barg"] = { :bargain => "niag", "blah" => "[FILTERED]", "bar" => { "bargain" => { "blah" => "[FILTERED]", "hello" => "world!" } } }
assert_equal after_filter, parameter_filter.filter(before_filter)
end