This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module WhitelistMatcher | |
# Checks if all of the specified attributes are mass-assignable, and if all the others are protected. | |
# If used with should_not, then ONLY the specified attributes should be protected from mass assignment, and for all other it should be allowed | |
# (i.e. behavior similar to :except ) | |
# It also supports roles by chaining as() | |
# | |
# it { should whitelist(:email, :password, :password_confirmation) } | |
# it { should_not whitelist(:admin, :balance) | |
# it { should whitelist(:owner).as(:superuser) | |
# |
NewerOlder