I am using the strong_parameters
gem in my controllers, but I'm having a hard time understanding how I would test it.
Here's an example of my setup
class UserController < ActionController::Base
include ActiveModel::ForbiddenAttributesProtection
def create
@user = User.new(user_params)
if @user.save
...
end
end
private
def user_params
params.require(:user).permit(:first_name, :last_name, :username, :email)
end
end
I want to test the user_params
method to make sure that it is correctly filtering out malicious key/value pairs, but can't figure out how to do it. Has anyone else been through this?