Add test to make sure that to_unsafe_h don't mutate the target

上级 9f4c2632
......@@ -443,6 +443,16 @@ def walk_permitted(params)
assert_equal expected, params.to_unsafe_h
end
test "to_unsafe_h does not mutate the parameters" do
params = ActionController::Parameters.new("f" => { "language_facet" => ["Tibetan"] })
params[:f]
params.to_unsafe_h
assert_not_predicate params, :permitted?
assert_not_predicate params[:f], :permitted?
end
test "to_h only deep dups Ruby collections" do
company = Class.new do
attr_reader :dupped
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册