Skip to content

Commit 35226db

Browse files
committed
not raise against NEVER_UNPERMITTED_PARAMS
Add a test checking that any param included in Parameters::NEVER_UNPERMITTED_PARAMS will not raise an error even if not explicitly permitted.
1 parent 42397cc commit 35226db

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test/raise_on_unpermitted_params_test.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,16 @@ def teardown
3030
params.permit(:book => [:pages])
3131
end
3232
end
33-
end
33+
34+
test "not raise on params included in NEVER_UNPERMITTED_PARAMS" do
35+
# NEVER_UNPERMITTED_PARAMS = %w( controller action )
36+
key = ActionController::Parameters::NEVER_UNPERMITTED_PARAMS.sample
37+
params = ActionController::Parameters.new({
38+
key => "Turnips"
39+
})
40+
41+
assert_nothing_raised(ActionController::UnpermittedParameters) do
42+
params.permit()
43+
end
44+
end
45+
end

0 commit comments

Comments
 (0)