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

@ -21,7 +21,7 @@ describe Api::V1::Accounts::RelationshipsController do
lewis.follow!(user.account)
end
context 'provided only one ID' do
context 'when provided only one ID' do
before do
get :index, params: { id: simon.id }
end
@ -39,7 +39,7 @@ describe Api::V1::Accounts::RelationshipsController do
end
end
context 'provided multiple IDs' do
context 'when provided multiple IDs' do
before do
get :index, params: { id: [simon.id, lewis.id] }
end

View file

@ -30,7 +30,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
post :create, params: { username: 'test', password: '12345678', email: 'hello@world.tld', agreement: agreement }
end
context 'given truthy agreement' do
context 'when given truthy agreement' do
let(:agreement) { 'true' }
it 'returns http success' do
@ -48,7 +48,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
end
end
context 'given no agreement' do
context 'when given no agreement' do
it 'returns http unprocessable entity' do
expect(response).to have_http_status(422)
end
@ -121,7 +121,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
end
end
context 'modifying follow options' do
context 'when modifying follow options' do
let(:locked) { false }
before do

View file

@ -84,7 +84,7 @@ RSpec.describe Api::V1::Admin::DomainBlocksController, type: :controller do
BlockDomainService.new.call(domain_block)
end
context 'downgrading a domain suspension to silence' do
context 'when downgrading a domain suspension to silence' do
let(:original_severity) { 'suspend' }
let(:new_severity) { 'silence' }
@ -101,7 +101,7 @@ RSpec.describe Api::V1::Admin::DomainBlocksController, type: :controller do
end
end
context 'upgrading a domain silence to suspend' do
context 'when upgrading a domain silence to suspend' do
let(:original_severity) { 'silence' }
let(:new_severity) { 'suspend' }

View file

@ -15,14 +15,14 @@ RSpec.describe Api::V1::Emails::ConfirmationsController, type: :controller do
allow(controller).to receive(:doorkeeper_token) { token }
end
context 'from a random app' do
context 'when from a random app' do
it 'returns http forbidden' do
post :create
expect(response).to have_http_status(403)
end
end
context 'from an app that created the account' do
context 'when from an app that created the account' do
before do
user.update(created_by_application: token.application)
end
@ -35,7 +35,7 @@ RSpec.describe Api::V1::Emails::ConfirmationsController, type: :controller do
expect(response).to have_http_status(403)
end
context 'but user changed e-mail and has not confirmed it' do
context 'with user changed e-mail and has not confirmed it' do
before do
user.update(email: 'foo@bar.com')
end

View file

@ -9,7 +9,7 @@ RSpec.describe Api::V1::Instances::ActivityController, type: :controller do
expect(response).to have_http_status(200)
end
context '!Setting.activity_api_enabled' do
context 'with !Setting.activity_api_enabled' do
it 'returns 404' do
Setting.activity_api_enabled = false

View file

@ -9,7 +9,7 @@ RSpec.describe Api::V1::Instances::PeersController, type: :controller do
expect(response).to have_http_status(200)
end
context '!Setting.peers_api_enabled' do
context 'with !Setting.peers_api_enabled' do
it 'returns 404' do
Setting.peers_api_enabled = false

View file

@ -37,7 +37,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do
end
end
context 'image/jpeg' do
context 'with image/jpeg' do
before do
post :create, params: { file: fixture_file_upload('attachment.jpg', 'image/jpeg') }
end
@ -59,7 +59,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do
end
end
context 'image/gif' do
context 'with image/gif' do
before do
post :create, params: { file: fixture_file_upload('attachment.gif', 'image/gif') }
end
@ -81,7 +81,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do
end
end
context 'video/webm' do
context 'with video/webm' do
before do
post :create, params: { file: fixture_file_upload('attachment.webm', 'video/webm') }
end

View file

@ -66,7 +66,7 @@ RSpec.describe Api::V2::FiltersController, type: :controller do
let!(:filter) { Fabricate(:custom_filter, account: user.account) }
let!(:keyword) { Fabricate(:custom_filter_keyword, custom_filter: filter) }
context 'updating filter parameters' do
context 'when updating filter parameters' do
before do
put :update, params: { id: filter.id, title: 'updated', context: %w(home public) }
end
@ -84,7 +84,7 @@ RSpec.describe Api::V2::FiltersController, type: :controller do
end
end
context 'updating keywords in bulk' do
context 'when updating keywords in bulk' do
before do
allow(redis).to receive_messages(publish: nil)
put :update, params: { id: filter.id, keywords_attributes: [{ id: keyword.id, keyword: 'updated' }] }