Skip to content
This repository has been archived by the owner on Aug 17, 2017. It is now read-only.

test, not raise against NEVER_UNPERMITTED_PARAMS #229

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion test/raise_on_unpermitted_params_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,16 @@ def teardown
params.permit(:book => [:pages])
end
end
end

test "not raise on params included in NEVER_UNPERMITTED_PARAMS" do
# NEVER_UNPERMITTED_PARAMS = %w( controller action )
key = ActionController::Parameters::NEVER_UNPERMITTED_PARAMS.sample
params = ActionController::Parameters.new({
key => "Turnips"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to test each entries of the NEVER_UNPERMITTED_PARAMS array. isn't it?

})

assert_nothing_raised(ActionController::UnpermittedParameters) do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to pass the exception.

params.permit()
end
end
end