Skip to content

Commit

Permalink
fix: Remove non-inclusive terms (#1557)
Browse files Browse the repository at this point in the history
We have been using both the terms "whitelist" and "blacklist" to refer
to a list of approved/denied values, but I wanted to point out that our dev
community recommends the term "allowlist" and "blocklist" instead.
  • Loading branch information
matsales28 committed May 17, 2023
1 parent 0394a10 commit dee0d9f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/shoulda/matchers/action_controller/permit_matcher.rb
Expand Up @@ -11,7 +11,7 @@ module Shoulda
module Matchers
module ActionController
# The `permit` matcher tests that an action in your controller receives a
# whitelist of parameters using Rails' Strong Parameters feature
# allowlist of parameters using Rails' Strong Parameters feature
# (specifically that `permit` was called with the correct arguments).
#
# Here's an example:
Expand Down
Expand Up @@ -3,10 +3,10 @@ module Matchers
module ActiveModel
# The `validate_exclusion_of` matcher tests usage of the
# `validates_exclusion_of` validation, asserting that an attribute cannot
# take a blacklist of values, and inversely, can take values outside of
# take a blocklist of values, and inversely, can take values outside of
# this list.
#
# If your blacklist is an array of values, use `in_array`:
# If your blocklist an array of values, use `in_array`:
#
# class Game
# include ActiveModel::Model
Expand All @@ -29,7 +29,7 @@ module ActiveModel
# in_array(['Mac', 'Linux'])
# end
#
# If your blacklist is a range of values, use `in_range`:
# If your blocklist is a range of values, use `in_range`:
#
# class Game
# include ActiveModel::Model
Expand Down
Expand Up @@ -8,9 +8,9 @@ class ExampleClass; end
module ActiveModel
# The `validate_inclusion_of` matcher tests usage of the
# `validates_inclusion_of` validation, asserting that an attribute can
# take a whitelist of values and cannot take values outside of this list.
# take a allowlist of values and cannot take values outside of this list.
#
# If your whitelist is an array of values, use `in_array`:
# If your allowlist is an array of values, use `in_array`:
#
# class Issue
# include ActiveModel::Model
Expand All @@ -34,7 +34,7 @@ module ActiveModel
# in_array(['open', 'resolved', 'unresolved'])
# end
#
# If your whitelist is a range of values, use `in_range`:
# If your allowlist is a range of values, use `in_range`:
#
# class Issue
# include ActiveModel::Model
Expand Down
6 changes: 3 additions & 3 deletions spec/support/unit/model_creation_strategies/active_record.rb
Expand Up @@ -50,7 +50,7 @@ def define_class_for_model
run_block(model, block)
end

if whitelist_attributes? && model.respond_to?(:attr_accessible)
if allowlist_attributes? && model.respond_to?(:attr_accessible)
model.attr_accessible(*columns.keys)
end

Expand Down Expand Up @@ -85,8 +85,8 @@ def customize_table
options.fetch(:customize_table) { proc {} }
end

def whitelist_attributes?
options.fetch(:whitelist_attributes, true)
def allowlist_attributes?
options.fetch(:allowlist_attributes, true)
end
end
end
Expand Down

0 comments on commit dee0d9f

Please sign in to comment.