0
0
Fork 0

Fix RSpec/ContextWording cop (#24739)

This commit is contained in:
Matt Jankowski 2023-05-03 23:49:08 -04:00 committed by GitHub
parent cf18cc2891
commit 710745e16b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
105 changed files with 559 additions and 668 deletions

View file

@ -14,7 +14,7 @@ RSpec.describe DisallowedHashtagsValidator, type: :validator do
let(:status) { double(errors: errors, local?: local, reblog?: reblog, text: disallowed_tags.map { |x| "##{x}" }.join(' ')) }
let(:errors) { double(add: nil) }
context 'for a remote reblog' do
context 'with a remote reblog' do
let(:local) { false }
let(:reblog) { true }
@ -23,7 +23,7 @@ RSpec.describe DisallowedHashtagsValidator, type: :validator do
end
end
context 'for a local original status' do
context 'with a local original status' do
let(:local) { true }
let(:reblog) { false }

View file

@ -6,7 +6,7 @@ describe EmailMxValidator do
describe '#validate' do
let(:user) { double(email: 'foo@example.com', sign_up_ip: '1.2.3.4', errors: double(add: nil)) }
context 'for an e-mail domain that is explicitly allowed' do
context 'with an e-mail domain that is explicitly allowed' do
around do |block|
tmp = Rails.configuration.x.email_domains_whitelist
Rails.configuration.x.email_domains_whitelist = 'example.com'

View file

@ -18,7 +18,7 @@ RSpec.describe FollowLimitValidator, type: :validator do
let(:_nil) { true }
let(:local) { false }
context 'follow.account.nil? || !follow.account.local?' do
context 'with follow.account.nil? || !follow.account.local?' do
let(:_nil) { true }
it 'not calls errors.add' do
@ -26,11 +26,11 @@ RSpec.describe FollowLimitValidator, type: :validator do
end
end
context '!(follow.account.nil? || !follow.account.local?)' do
context 'with !(follow.account.nil? || !follow.account.local?)' do
let(:_nil) { false }
let(:local) { true }
context 'limit_reached?' do
context 'when limit_reached?' do
let(:limit_reached) { true }
it 'calls errors.add' do
@ -39,7 +39,7 @@ RSpec.describe FollowLimitValidator, type: :validator do
end
end
context '!limit_reached?' do
context 'with !limit_reached?' do
let(:limit_reached) { false }
it 'not calls errors.add' do

View file

@ -18,7 +18,7 @@ RSpec.describe PollValidator, type: :validator do
expect(errors).to_not have_received(:add)
end
context 'expires just 5 min ago' do
context 'when expires is just 5 min ago' do
let(:expires_at) { 5.minutes.from_now }
it 'not calls errors add' do

View file

@ -20,7 +20,7 @@ RSpec.describe StatusPinValidator, type: :validator do
let(:reblog) { false }
let(:count) { 0 }
context 'pin.status.reblog?' do
context 'when pin.status.reblog?' do
let(:reblog) { true }
it 'calls errors.add' do
@ -28,7 +28,7 @@ RSpec.describe StatusPinValidator, type: :validator do
end
end
context 'pin.account_id != pin.status.account_id' do
context 'when pin.account_id != pin.status.account_id' do
let(:pin_account_id) { 1 }
let(:status_account_id) { 2 }
@ -37,7 +37,7 @@ RSpec.describe StatusPinValidator, type: :validator do
end
end
context 'if pin.status.direct_visibility?' do
context 'when pin.status.direct_visibility?' do
let(:visibility) { 'direct' }
it 'calls errors.add' do
@ -45,7 +45,7 @@ RSpec.describe StatusPinValidator, type: :validator do
end
end
context 'pin.account.status_pins.count > 4 && pin.account.local?' do
context 'when pin.account.status_pins.count > 4 && pin.account.local?' do
let(:count) { 5 }
let(:local) { true }

View file

@ -13,7 +13,7 @@ RSpec.describe UnreservedUsernameValidator, type: :validator do
let(:account) { double(username: username, errors: errors) }
let(:errors) { double(add: nil) }
context '@username.blank?' do
context 'when @username is blank?' do
let(:username) { nil }
it 'not calls errors.add' do
@ -21,10 +21,10 @@ RSpec.describe UnreservedUsernameValidator, type: :validator do
end
end
context '!@username.blank?' do
context 'when @username is not blank?' do
let(:username) { 'f' }
context 'reserved_username?' do
context 'with reserved_username?' do
let(:reserved_username) { true }
it 'calls errors.add' do
@ -32,7 +32,7 @@ RSpec.describe UnreservedUsernameValidator, type: :validator do
end
end
context '!reserved_username?' do
context 'when username is not reserved' do
let(:reserved_username) { false }
it 'not calls errors.add' do

View file

@ -15,7 +15,7 @@ RSpec.describe URLValidator, type: :validator do
let(:value) { '' }
let(:attribute) { :foo }
context 'unless compliant?' do
context 'when not compliant?' do
let(:compliant) { false }
it 'calls errors.add' do
@ -23,7 +23,7 @@ RSpec.describe URLValidator, type: :validator do
end
end
context 'if compliant?' do
context 'when compliant?' do
let(:compliant) { true }
it 'not calls errors.add' do