Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change potentially offensive terminology #836

Merged
merged 1 commit into from Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions spec/rubocop/cop/rspec/context_wording_spec.rb
Expand Up @@ -76,15 +76,15 @@
context 'when configured' do
let(:cop_config) { { 'Prefixes' => %w[if] } }

it 'finds context without whitelisted prefixes at the beginning' do
it 'finds context without allowed prefixes at the beginning' do
expect_offense(<<-RUBY)
context 'when display name is present' do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Start context description with 'if'.
end
RUBY
end

it 'skips descriptions with whitelisted prefixes at the beginning' do
it 'skips descriptions with allowed prefixes at the beginning' do
expect_no_offenses(<<-RUBY)
context 'if display name is present' do
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