Sha256: 40c4bdf2948c576a29f862451569f24c7d013a2ad4a8a1fa74782688264363c9
Contents?: true
Size: 705 Bytes
Versions: 2
Compression:
Stored size: 705 Bytes
Contents
require 'abstract_unit' class PeopleController < ActionController::Base def create render text: params[:person].permitted? ? "permitted" : "forbidden" end def create_with_permit render text: params[:person].permit(:name).permitted? ? "permitted" : "forbidden" end end class ActionControllerPermittedParamsTest < ActionController::TestCase tests PeopleController test "parameters are forbidden" do post :create, { person: { name: "Mjallo!" } } assert_equal "forbidden", response.body end test "parameters can be permitted and are then not forbidden" do post :create_with_permit, { person: { name: "Mjallo!" } } assert_equal "permitted", response.body end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activejob-lock-0.0.2 | rails/actionpack/test/controller/permitted_params_test.rb |
activejob-lock-0.0.1 | rails/actionpack/test/controller/permitted_params_test.rb |