aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorRafael França <rafael@franca.dev>2019-07-23 13:19:18 -0400
committerGitHub <noreply@github.com>2019-07-23 13:19:18 -0400
commitd3327ca40eaea734b2302c7a9ffa0360033a7484 (patch)
tree03f45161d5d896a65b2415c0c4187b241045072b /activesupport/test
parentd8bda0170210101df448313dcbf4ddd118e90327 (diff)
parent479b8ae28d80335d034900edc4f3f9fc6b17751e (diff)
downloadrails-d3327ca40eaea734b2302c7a9ffa0360033a7484.tar.gz
rails-d3327ca40eaea734b2302c7a9ffa0360033a7484.tar.bz2
rails-d3327ca40eaea734b2302c7a9ffa0360033a7484.zip
Merge pull request #36370 from ptoomey3/master
Add support for Proc based parameter filtering on arrays of values
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/parameter_filter_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/test/parameter_filter_test.rb b/activesupport/test/parameter_filter_test.rb
index d2dc71061d..e680a22479 100644
--- a/activesupport/test/parameter_filter_test.rb
+++ b/activesupport/test/parameter_filter_test.rb
@@ -28,10 +28,17 @@ class ParameterFilterTest < ActiveSupport::TestCase
value.replace("world!") if original_params["barg"]["blah"] == "bar" && key == "hello"
}
+ filter_words << lambda { |key, value|
+ value.upcase! if key == "array_elements"
+ }
+
parameter_filter = ActiveSupport::ParameterFilter.new(filter_words)
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!" } } }
+ before_filter["array_elements"] = %w(element1 element2)
+ after_filter["array_elements"] = %w(ELEMENT1 ELEMENT2)
+
assert_equal after_filter, parameter_filter.filter(before_filter)
end
end