Sha256: 2d07fb588e62c60f0a9e9068456a68d63b6127cb9d02ddc801c1a0f90df320cf
Contents?: true
Size: 1.02 KB
Versions: 47
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true require "abstract_unit" require "action_controller/metal/strong_parameters" class AlwaysPermittedParametersTest < ActiveSupport::TestCase def setup ActionController::Parameters.action_on_unpermitted_parameters = :raise ActionController::Parameters.always_permitted_parameters = %w( controller action format ) end def teardown ActionController::Parameters.action_on_unpermitted_parameters = false ActionController::Parameters.always_permitted_parameters = %w( controller action ) end test "returns super on missing constant other than NEVER_UNPERMITTED_PARAMS" do ActionController::Parameters.superclass.stub :const_missing, "super" do assert_equal "super", ActionController::Parameters::NON_EXISTING_CONSTANT end end test "permits parameters that are whitelisted" do params = ActionController::Parameters.new( book: { pages: 65 }, format: "json") permitted = params.permit book: [:pages] assert_predicate permitted, :permitted? end end
Version data entries
47 entries across 47 versions & 1 rubygems