forked from rails/strong_parameters
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We were using presence for a reason -- when you wrap parameters via j…
…son calls, you will get an empty hash on no params -- exactly what we are trying to protect against
- Loading branch information
Showing
3 changed files
with
15 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
require 'test_helper' | ||
require 'action_controller/parameters' | ||
|
||
class ParametersRequireTest < ActiveSupport::TestCase | ||
test "required parameters must be present not merely not nil" do | ||
assert_raises(ActionController::ParameterMissing) do | ||
ActionController::Parameters.new(person: {}).required(:person) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters