diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0d0fbfac916..02356fdbe14 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -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 diff --git a/spec/controllers/accounts_controller_spec.rb b/spec/controllers/accounts_controller_spec.rb index 36675648026..5a8585b0697 100644 --- a/spec/controllers/accounts_controller_spec.rb +++ b/spec/controllers/accounts_controller_spec.rb @@ -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 diff --git a/spec/controllers/activitypub/collections_controller_spec.rb b/spec/controllers/activitypub/collections_controller_spec.rb index 8878474885a..e2802cf565b 100644 --- a/spec/controllers/activitypub/collections_controller_spec.rb +++ b/spec/controllers/activitypub/collections_controller_spec.rb @@ -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 diff --git a/spec/controllers/admin/statuses_controller_spec.rb b/spec/controllers/admin/statuses_controller_spec.rb index fc27f714736..7171c0e886a 100644 --- a/spec/controllers/admin/statuses_controller_spec.rb +++ b/spec/controllers/admin/statuses_controller_spec.rb @@ -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 diff --git a/spec/controllers/admin/users/roles_controller_spec.rb b/spec/controllers/admin/users/roles_controller_spec.rb index fe2cee01b5c..97f69a0b0a9 100644 --- a/spec/controllers/admin/users/roles_controller_spec.rb +++ b/spec/controllers/admin/users/roles_controller_spec.rb @@ -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 } diff --git a/spec/controllers/api/v1/accounts_controller_spec.rb b/spec/controllers/api/v1/accounts_controller_spec.rb index 1cca69de73f..992fb0e8934 100644 --- a/spec/controllers/api/v1/accounts_controller_spec.rb +++ b/spec/controllers/api/v1/accounts_controller_spec.rb @@ -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 diff --git a/spec/controllers/api/v1/admin/account_actions_controller_spec.rb b/spec/controllers/api/v1/admin/account_actions_controller_spec.rb index 1c976455e1c..0f39a80b12c 100644 --- a/spec/controllers/api/v1/admin/account_actions_controller_spec.rb +++ b/spec/controllers/api/v1/admin/account_actions_controller_spec.rb @@ -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 diff --git a/spec/controllers/api/v1/admin/domain_allows_controller_spec.rb b/spec/controllers/api/v1/admin/domain_allows_controller_spec.rb index ca63ea5a7ec..69aeb6451a3 100644 --- a/spec/controllers/api/v1/admin/domain_allows_controller_spec.rb +++ b/spec/controllers/api/v1/admin/domain_allows_controller_spec.rb @@ -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 diff --git a/spec/controllers/api/v1/statuses_controller_spec.rb b/spec/controllers/api/v1/statuses_controller_spec.rb index ab6f80a61b2..c2bdba9ace3 100644 --- a/spec/controllers/api/v1/statuses_controller_spec.rb +++ b/spec/controllers/api/v1/statuses_controller_spec.rb @@ -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 diff --git a/spec/controllers/auth/registrations_controller_spec.rb b/spec/controllers/auth/registrations_controller_spec.rb index b52d7c6ce4d..ec82cd07b6c 100644 --- a/spec/controllers/auth/registrations_controller_spec.rb +++ b/spec/controllers/auth/registrations_controller_spec.rb @@ -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 diff --git a/spec/features/log_in_spec.rb b/spec/features/log_in_spec.rb index 934575ea63a..c64e19d2b7c 100644 --- a/spec/features/log_in_spec.rb +++ b/spec/features/log_in_spec.rb @@ -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 diff --git a/spec/lib/activitypub/activity/undo_spec.rb b/spec/lib/activitypub/activity/undo_spec.rb index b4cbc71963d..58e71fc4e8d 100644 --- a/spec/lib/activitypub/activity/undo_spec.rb +++ b/spec/lib/activitypub/activity/undo_spec.rb @@ -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 diff --git a/spec/lib/status_reach_finder_spec.rb b/spec/lib/status_reach_finder_spec.rb index c53ac279921..7181717dc11 100644 --- a/spec/lib/status_reach_finder_spec.rb +++ b/spec/lib/status_reach_finder_spec.rb @@ -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 diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index d966bffa9b1..7cd914774a9 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -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') } diff --git a/spec/models/email_domain_block_spec.rb b/spec/models/email_domain_block_spec.rb index 9d9c7488775..5874c5e53c4 100644 --- a/spec/models/email_domain_block_spec.rb +++ b/spec/models/email_domain_block_spec.rb @@ -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 diff --git a/spec/models/trends/statuses_spec.rb b/spec/models/trends/statuses_spec.rb index 29a20a5955a..cea5dc5e0fa 100644 --- a/spec/models/trends/statuses_spec.rb +++ b/spec/models/trends/statuses_spec.rb @@ -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 diff --git a/spec/models/trends/tags_spec.rb b/spec/models/trends/tags_spec.rb index 09ac918d000..79cdee3461b 100644 --- a/spec/models/trends/tags_spec.rb +++ b/spec/models/trends/tags_spec.rb @@ -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) diff --git a/spec/models/user_role_spec.rb b/spec/models/user_role_spec.rb index 16bb4358e67..27b96741466 100644 --- a/spec/models/user_role_spec.rb +++ b/spec/models/user_role_spec.rb @@ -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 diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 554e7efb68f..bb61c02a637 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -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 diff --git a/spec/services/fetch_link_card_service_spec.rb b/spec/services/fetch_link_card_service_spec.rb index 6495b323c41..133d6644107 100644 --- a/spec/services/fetch_link_card_service_spec.rb +++ b/spec/services/fetch_link_card_service_spec.rb @@ -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 diff --git a/spec/services/notify_service_spec.rb b/spec/services/notify_service_spec.rb index 8c99431fac4..8fcb5865804 100644 --- a/spec/services/notify_service_spec.rb +++ b/spec/services/notify_service_spec.rb @@ -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 diff --git a/spec/services/process_mentions_service_spec.rb b/spec/services/process_mentions_service_spec.rb index a28b6db409c..0db73c41fab 100644 --- a/spec/services/process_mentions_service_spec.rb +++ b/spec/services/process_mentions_service_spec.rb @@ -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