diff options
Diffstat (limited to 'actionpack/test/controller/required_params_test.rb')
-rw-r--r-- | actionpack/test/controller/required_params_test.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/actionpack/test/controller/required_params_test.rb b/actionpack/test/controller/required_params_test.rb index 98b8e44b22..168f64ce41 100644 --- a/actionpack/test/controller/required_params_test.rb +++ b/actionpack/test/controller/required_params_test.rb @@ -49,20 +49,20 @@ class ParametersRequireTest < ActiveSupport::TestCase end end - test "require array of params" do - safe_params = ActionController::Parameters.new(person: {first_name: 'Gaurish', title: 'Mjallo'}) + test "require array when all required params are present" do + safe_params = ActionController::Parameters.new(person: {first_name: 'Gaurish', title: 'Mjallo', city: 'Barcelona'}) .require(:person) - .require([:first_name, :last_name]) + .require([:first_name, :title]) assert_kind_of Array, safe_params assert_equal ['Gaurish', 'Mjallo'], safe_params end - test "require array when it contains a nil values" do + test "require array when a required param is missing" do assert_raises(ActionController::ParameterMissing) do - safe_params = ActionController::Parameters.new(person: {first_name: 'Gaurish', title: nil}) + ActionController::Parameters.new(person: {first_name: 'Gaurish', title: nil}) .require(:person) - .require([:first_name, :last_name]) + .require([:first_name, :title]) end end end |