diff options
author | Matthew Draper <matthew@trebex.net> | 2014-06-14 05:53:45 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2014-06-14 06:14:19 +0930 |
commit | 497def80b53db73712a6abf2c066e9bc4980ccd2 (patch) | |
tree | 0781c2304c05e1d5eef7661351f05ab03f3a26ad /actionpack/test | |
parent | 49fee3d271e52a44a7bc7fcbbcb00792b613b7df (diff) | |
parent | 540d1535316d6ecbe755ee66dfcbc23dc0bde3a5 (diff) | |
download | rails-497def80b53db73712a6abf2c066e9bc4980ccd2.tar.gz rails-497def80b53db73712a6abf2c066e9bc4980ccd2.tar.bz2 rails-497def80b53db73712a6abf2c066e9bc4980ccd2.zip |
Merge pull request #15692 from sromano/falseClass
ActionController::Parameters#require now accepts FalseClass values
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/required_params_test.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/actionpack/test/controller/required_params_test.rb b/actionpack/test/controller/required_params_test.rb index 25d0337212..6803dbbb62 100644 --- a/actionpack/test/controller/required_params_test.rb +++ b/actionpack/test/controller/required_params_test.rb @@ -24,10 +24,26 @@ class ActionControllerRequiredParamsTest < ActionController::TestCase post :create, { book: { name: "Mjallo!" } } assert_response :ok end + + test "required parameters with false value will not raise" do + post :create, { book: { name: false } } + assert_response :ok + end end class ParametersRequireTest < ActiveSupport::TestCase - test "required parameters must be present not merely not nil" do + + test "required parameters should accept and return false value" do + assert_equal(false, ActionController::Parameters.new(person: false).require(:person)) + end + + test "required parameters must not be nil" do + assert_raises(ActionController::ParameterMissing) do + ActionController::Parameters.new(person: nil).require(:person) + end + end + + test "required parameters must not be empty" do assert_raises(ActionController::ParameterMissing) do ActionController::Parameters.new(person: {}).require(:person) end |