Skip to content

Commit

Permalink
Change potentially offensive terminology
Browse files Browse the repository at this point in the history
I think the few places we use the term "whitelist", we really don't need
to. Changing to use "allowed" etc. instead.

RuboCop did similar changes in
rubocop/rubocop#7469.
  • Loading branch information
bquorning committed Nov 5, 2019
1 parent 0a65295 commit 811998b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/rubocop/cop/rspec_rails/http_status.rb
Expand Up @@ -107,15 +107,15 @@ class NumericStyleChecker
MSG = 'Prefer `%<prefer>s` over `%<current>s` ' \
'to describe HTTP status code.'

WHITELIST_STATUS = %i[error success missing redirect].freeze
ALLOWED_STATUSES = %i[error success missing redirect].freeze

attr_reader :node
def initialize(node)
@node = node
end

def offensive?
!node.int_type? && !whitelisted_symbol?
!node.int_type? && !allowed_symbol?
end

def message
Expand All @@ -136,8 +136,8 @@ def symbol
node.value
end

def whitelisted_symbol?
node.sym_type? && WHITELIST_STATUS.include?(node.value)
def allowed_symbol?
node.sym_type? && ALLOWED_STATUSES.include?(node.value)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/rspec_rails/http_status_spec.rb
Expand Up @@ -60,7 +60,7 @@
RUBY
end

it 'does not register an offense when using whitelisted symbols' do
it 'does not register an offense when using allowed symbols' do
expect_no_offenses(<<-RUBY)
it { is_expected.to have_http_status :error }
it { is_expected.to have_http_status :success }
Expand Down

0 comments on commit 811998b

Please sign in to comment.