Fix RSpec/MissingExampleGroupArgument cop (#25310)

pull/62/head
Matt Jankowski 2023-06-06 09:51:42 -04:00 committed by GitHub
parent b74c3cd708
commit 6c0e3f490a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 38 additions and 68 deletions

View File

@ -393,30 +393,6 @@ RSpec/MessageSpies:
- 'spec/spec_helper.rb'
- 'spec/validators/status_length_validator_spec.rb'
RSpec/MissingExampleGroupArgument:
Exclude:
- 'spec/controllers/accounts_controller_spec.rb'
- 'spec/controllers/activitypub/collections_controller_spec.rb'
- 'spec/controllers/admin/statuses_controller_spec.rb'
- 'spec/controllers/admin/users/roles_controller_spec.rb'
- 'spec/controllers/api/v1/accounts_controller_spec.rb'
- 'spec/controllers/api/v1/admin/account_actions_controller_spec.rb'
- 'spec/controllers/api/v1/admin/domain_allows_controller_spec.rb'
- 'spec/controllers/api/v1/statuses_controller_spec.rb'
- 'spec/controllers/auth/registrations_controller_spec.rb'
- 'spec/features/log_in_spec.rb'
- 'spec/lib/activitypub/activity/undo_spec.rb'
- 'spec/lib/status_reach_finder_spec.rb'
- 'spec/models/account_spec.rb'
- 'spec/models/email_domain_block_spec.rb'
- 'spec/models/trends/statuses_spec.rb'
- 'spec/models/trends/tags_spec.rb'
- 'spec/models/user_role_spec.rb'
- 'spec/models/user_spec.rb'
- 'spec/services/fetch_link_card_service_spec.rb'
- 'spec/services/notify_service_spec.rb'
- 'spec/services/process_mentions_service_spec.rb'
RSpec/MultipleExpectations:
Max: 19

View File

@ -99,7 +99,7 @@ RSpec.describe AccountsController do
end
end
context do
context 'with a normal account in an HTML request' do
before do
get :show, params: { username: account.username, format: format }
end
@ -173,7 +173,7 @@ RSpec.describe AccountsController do
end
end
context do
context 'with a normal account in a JSON request' do
before do
get :show, params: { username: account.username, format: format }
end
@ -314,7 +314,7 @@ RSpec.describe AccountsController do
it_behaves_like 'cacheable response'
end
context do
context 'with a normal account in an RSS request' do
before do
get :show, params: { username: account.username, format: format }
end

View File

@ -88,7 +88,7 @@ RSpec.describe ActivityPub::CollectionsController do
context 'with signature' do
let(:remote_account) { Fabricate(:account, domain: 'example.com') }
context do
context 'when getting a featured resource' do
before do
get :show, params: { id: 'featured', account_username: account.username }
end

View File

@ -20,7 +20,7 @@ describe Admin::StatusesController do
end
describe 'GET #index' do
context do
context 'with a valid account' do
before do
get :index, params: { account_id: account.id }
end

View File

@ -40,7 +40,7 @@ describe Admin::Users::RolesController do
put :update, params: { user_id: user.id, user: { role_id: selected_role.id } }
end
context do
context 'with manage roles permissions' do
let(:permissions) { UserRole::FLAGS[:manage_roles] }
let(:position) { 1 }

View File

@ -73,7 +73,7 @@ RSpec.describe Api::V1::AccountsController do
let(:scopes) { 'write:follows' }
let(:other_account) { Fabricate(:account, username: 'bob', locked: locked) }
context do
context 'when posting to an other account' do
before do
post :follow, params: { id: other_account.id }
end

View File

@ -32,7 +32,7 @@ RSpec.describe Api::V1::Admin::AccountActionsController do
end
describe 'POST #create' do
context do
context 'with type of disable' do
before do
post :create, params: { account_id: account.id, type: 'disable' }
end

View File

@ -96,7 +96,7 @@ RSpec.describe Api::V1::Admin::DomainAllowsController do
describe 'POST #create' do
let!(:domain_allow) { Fabricate(:domain_allow, domain: 'example.com') }
context do
context 'with a valid domain' do
before do
post :create, params: { domain: 'foo.bar.com' }
end

View File

@ -120,7 +120,7 @@ RSpec.describe Api::V1::StatusesController do
describe 'POST #create' do
let(:scopes) { 'write:statuses' }
context do
context 'with a basic status body' do
before do
post :create, params: { status: 'Hello world' }
end

View File

@ -79,7 +79,7 @@ RSpec.describe Auth::RegistrationsController do
request.env['devise.mapping'] = Devise.mappings[:user]
end
context do
context 'with open registrations' do
around do |example|
registrations_mode = Setting.registrations_mode
example.run
@ -111,7 +111,7 @@ RSpec.describe Auth::RegistrationsController do
end
end
context do
context 'when an accept language is present in headers' do
subject do
Setting.registrations_mode = 'open'
request.headers['Accept-Language'] = accept_language

View File

@ -32,7 +32,7 @@ describe 'Log in' do
expect(subject).to have_css('.flash-message', text: failure_message('invalid'))
end
context do
context 'when confirmed at is nil' do
let(:confirmed_at) { nil }
it 'A unconfirmed user is able to log in' do

View File

@ -31,7 +31,7 @@ RSpec.describe ActivityPub::Activity::Undo do
}
end
context do
context 'when not atomUri' do
before do
Fabricate(:status, reblog: status, account: sender, uri: 'bar')
end

View File

@ -71,10 +71,8 @@ describe StatusReachFinder do
bob.statuses.create!(thread: status, text: 'Hoge')
end
context do
it 'includes the inbox of the replier' do
expect(subject.inboxes).to include 'https://foo.bar/inbox'
end
it 'includes the inbox of the replier' do
expect(subject.inboxes).to include 'https://foo.bar/inbox'
end
context 'when status is not public' do
@ -90,10 +88,8 @@ describe StatusReachFinder do
let(:bob) { Fabricate(:account, username: 'bob', domain: 'foo.bar', protocol: :activitypub, inbox_url: 'https://foo.bar/inbox') }
let(:parent_status) { Fabricate(:status, account: bob) }
context do
it 'includes the inbox of the replied-to account' do
expect(subject.inboxes).to include 'https://foo.bar/inbox'
end
it 'includes the inbox of the replied-to account' do
expect(subject.inboxes).to include 'https://foo.bar/inbox'
end
context 'when status is not public and replied-to account is not mentioned' do

View File

@ -3,7 +3,7 @@
require 'rails_helper'
RSpec.describe Account do
context do
context 'with an account record' do
subject { Fabricate(:account) }
let(:bob) { Fabricate(:account, username: 'bob') }

View File

@ -9,7 +9,7 @@ RSpec.describe EmailDomainBlock do
context 'when given an e-mail address' do
let(:input) { "foo@#{domain}" }
context do
context 'with a top level domain' do
let(:domain) { 'example.com' }
it 'returns true if the domain is blocked' do
@ -23,7 +23,7 @@ RSpec.describe EmailDomainBlock do
end
end
context do
context 'with a subdomain' do
let(:domain) { 'mail.example.com' }
it 'returns true if it is a subdomain of a blocked domain' do

View File

@ -81,7 +81,7 @@ RSpec.describe Trends::Statuses do
4.times { reblog(status3, today) }
end
context do
context 'when status trends are refreshed' do
before do
subject.refresh(today)
end

View File

@ -44,7 +44,7 @@ RSpec.describe Trends::Tags do
4.times { |i| subject.add(tag2, i, today) }
end
context do
context 'when tag trends are refreshed' do
before do
subject.refresh(yesterday + 12.hours)
subject.refresh(at_time)

View File

@ -118,10 +118,8 @@ RSpec.describe UserRole do
end
end
context do
it 'returns permissions combined with the everyone role' do
expect(subject.computed_permissions).to eq described_class.everyone.permissions
end
it 'returns permissions combined with the everyone role' do
expect(subject.computed_permissions).to eq described_class.everyone.permissions
end
end

View File

@ -363,7 +363,7 @@ RSpec.describe User do
expect(user).to_not be_valid
end
context do
context 'with a blacklisted subdomain' do
around do |example|
old_blacklist = Rails.configuration.x.email_blacklist
example.run

View File

@ -20,7 +20,7 @@ RSpec.describe FetchLinkCardService, type: :service do
end
context 'with a local status' do
context do
context 'with an IDN url' do
let(:status) { Fabricate(:status, text: 'Check out http://example.中国') }
it 'works with IDN URLs' do
@ -28,7 +28,7 @@ RSpec.describe FetchLinkCardService, type: :service do
end
end
context do
context 'with an SJIS url' do
let(:status) { Fabricate(:status, text: 'Check out http://example.com/sjis') }
it 'works with SJIS' do
@ -37,7 +37,7 @@ RSpec.describe FetchLinkCardService, type: :service do
end
end
context do
context 'with invalid SJIS url' do
let(:status) { Fabricate(:status, text: 'Check out http://example.com/sjis_with_wrong_charset') }
it 'works with SJIS even with wrong charset header' do
@ -46,7 +46,7 @@ RSpec.describe FetchLinkCardService, type: :service do
end
end
context do
context 'with an koi8-r url' do
let(:status) { Fabricate(:status, text: 'Check out http://example.com/koi8-r') }
it 'works with koi8-r' do
@ -55,7 +55,7 @@ RSpec.describe FetchLinkCardService, type: :service do
end
end
context do
context 'with a windows-1251 url' do
let(:status) { Fabricate(:status, text: 'Check out http://example.com/windows-1251') }
it 'works with windows-1251' do
@ -64,7 +64,7 @@ RSpec.describe FetchLinkCardService, type: :service do
end
end
context do
context 'with a japanese path url' do
let(:status) { Fabricate(:status, text: 'テストhttp://example.com/日本語') }
it 'works with Japanese path string' do
@ -73,7 +73,7 @@ RSpec.describe FetchLinkCardService, type: :service do
end
end
context do
context 'with a hyphen-suffixed url' do
let(:status) { Fabricate(:status, text: 'test http://example.com/test-') }
it 'works with a URL ending with a hyphen' do
@ -81,7 +81,7 @@ RSpec.describe FetchLinkCardService, type: :service do
end
end
context do
context 'with an isolated url' do
let(:status) { Fabricate(:status, text: 'testhttp://example.com/sjis') }
it 'does not fetch URLs with not isolated from their surroundings' do
@ -89,7 +89,7 @@ RSpec.describe FetchLinkCardService, type: :service do
end
end
context do
context 'with a url that has a caret' do
let(:status) { Fabricate(:status, text: 'test http://example.com/test?data=file.gpx^1') }
it 'does fetch URLs with a caret in search params' do

View File

@ -127,7 +127,7 @@ RSpec.describe NotifyService, type: :service do
end
end
context do
context 'with muted and blocked users' do
let(:asshole) { Fabricate(:account, username: 'asshole') }
let(:reply_to) { Fabricate(:status, account: asshole) }
let(:activity) { Fabricate(:mention, account: recipient, status: Fabricate(:status, account: sender, thread: reply_to)) }
@ -144,7 +144,7 @@ RSpec.describe NotifyService, type: :service do
end
end
context do
context 'with sender as recipient' do
let(:sender) { recipient }
it 'does not notify when recipient is the sender' do

View File

@ -37,7 +37,7 @@ RSpec.describe ProcessMentionsService, type: :service do
let(:status) { Fabricate(:status, account: account, text: "Hello @#{remote_user.acct}", visibility: :public) }
context 'with ActivityPub' do
context do
context 'with a valid remote user' do
let!(:remote_user) { Fabricate(:account, username: 'remote_user', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') }
before do