diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-11-02 14:30:03 -0500 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-11-02 14:30:03 -0500 |
commit | f886fe2d8ccc900cde2629577e5c0be8c7d4c67f (patch) | |
tree | f2d92e0874f4984f8a2240debfe657c85b4a0792 /actionpack/test | |
parent | db41eb8a6ea88b854bf5cd11070ea4245e1639c5 (diff) | |
download | rails-f886fe2d8ccc900cde2629577e5c0be8c7d4c67f.tar.gz rails-f886fe2d8ccc900cde2629577e5c0be8c7d4c67f.tar.bz2 rails-f886fe2d8ccc900cde2629577e5c0be8c7d4c67f.zip |
Revert "Merge pull request #9660 from sebasoga/change_strong_parameters_require_behaviour"
This reverts commit c2b5a8e61ba0f35015e6ac949a5c8fce2042a1f2, reversing
changes made to 1918b12c0429caec2a6134ac5e5b42ade103fe90.
See: https://github.com/rails/rails/pull/9660#issuecomment-27627493
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/parameters/parameters_require_test.rb | 8 | ||||
-rw-r--r-- | actionpack/test/controller/required_params_test.rb | 19 | ||||
-rw-r--r-- | actionpack/test/dispatch/debug_exceptions_test.rb | 6 |
3 files changed, 1 insertions, 32 deletions
diff --git a/actionpack/test/controller/parameters/parameters_require_test.rb b/actionpack/test/controller/parameters/parameters_require_test.rb index 21b3eaa6b5..bdaba8d2d8 100644 --- a/actionpack/test/controller/parameters/parameters_require_test.rb +++ b/actionpack/test/controller/parameters/parameters_require_test.rb @@ -2,14 +2,8 @@ require 'abstract_unit' require 'action_controller/metal/strong_parameters' class ParametersRequireTest < ActiveSupport::TestCase - test "required parameters must be present" do + test "required parameters must be present not merely not nil" do assert_raises(ActionController::ParameterMissing) do - ActionController::Parameters.new(name: {}).require(:person) - end - end - - test "required parameters can't be blank" do - assert_raises(ActionController::EmptyParameter) do ActionController::Parameters.new(person: {}).require(:person) end end diff --git a/actionpack/test/controller/required_params_test.rb b/actionpack/test/controller/required_params_test.rb index b27069140b..343d57c300 100644 --- a/actionpack/test/controller/required_params_test.rb +++ b/actionpack/test/controller/required_params_test.rb @@ -5,11 +5,6 @@ class BooksController < ActionController::Base params.require(:book).require(:name) head :ok end - - def update - params.require(:book) - head :ok - end end class ActionControllerRequiredParamsTest < ActionController::TestCase @@ -25,20 +20,6 @@ class ActionControllerRequiredParamsTest < ActionController::TestCase end end - test "empty required parameters will raise an exception" do - assert_raise ActionController::EmptyParameter do - put :update, {book: {}} - end - - assert_raise ActionController::EmptyParameter do - put :update, {book: ''} - end - - assert_raise ActionController::EmptyParameter do - put :update, {book: nil} - end - end - test "required parameters that are present will not raise" do post :create, { book: { name: "Mjallo!" } } assert_response :ok diff --git a/actionpack/test/dispatch/debug_exceptions_test.rb b/actionpack/test/dispatch/debug_exceptions_test.rb index 6e28e4a982..3045a07ad6 100644 --- a/actionpack/test/dispatch/debug_exceptions_test.rb +++ b/actionpack/test/dispatch/debug_exceptions_test.rb @@ -43,8 +43,6 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest raise ActionController::UrlGenerationError, "No route matches" when "/parameter_missing" raise ActionController::ParameterMissing, :missing_param_key - when "/required_key_empty_value" - raise ActionController::EmptyParameter, :empty_param_key else raise "puke!" end @@ -128,10 +126,6 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest get "/parameter_missing", {}, {'action_dispatch.show_exceptions' => true} assert_response 400 assert_match(/ActionController::ParameterMissing/, body) - - get "/required_key_empty_value", {}, {'action_dispatch.show_exceptions' => true} - assert_response 400 - assert_match(/ActionController::EmptyParameter/, body) end test "rescue with text error for xhr request" do |