diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 6a7b7ef83da8140f586d1df9e7b8ade0e5627c44..e5d05c1cb21f71f2f29d69f8f8815bfd56ff4144 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -732,17 +732,6 @@ RSpec/MultipleExpectations: RSpec/MultipleMemoizedHelpers: Max: 21 -# This cop supports safe autocorrection (--autocorrect). -RSpec/MultipleSubjects: - Exclude: - - 'spec/controllers/activitypub/collections_controller_spec.rb' - - 'spec/controllers/activitypub/followers_synchronizations_controller_spec.rb' - - 'spec/controllers/activitypub/outboxes_controller_spec.rb' - - 'spec/controllers/api/web/embeds_controller_spec.rb' - - 'spec/controllers/emojis_controller_spec.rb' - - 'spec/controllers/follower_accounts_controller_spec.rb' - - 'spec/controllers/following_accounts_controller_spec.rb' - # Configuration parameters: AllowedGroups. RSpec/NestedGroups: Max: 6 diff --git a/spec/controllers/activitypub/collections_controller_spec.rb b/spec/controllers/activitypub/collections_controller_spec.rb index 77901131e72ca118280d23bd4274714c83190dc7..6b35a1206d19920f8dee8805553f1201bfb47dea 100644 --- a/spec/controllers/activitypub/collections_controller_spec.rb +++ b/spec/controllers/activitypub/collections_controller_spec.rb @@ -35,10 +35,9 @@ RSpec.describe ActivityPub::CollectionsController, type: :controller do describe 'GET #show' do context 'when id is "featured"' do context 'without signature' do - subject(:body) { body_as_json } - subject(:response) { get :show, params: { id: 'featured', account_username: account.username } } + let(:body) { body_as_json } let(:remote_account) { nil } it 'returns http success' do diff --git a/spec/controllers/activitypub/followers_synchronizations_controller_spec.rb b/spec/controllers/activitypub/followers_synchronizations_controller_spec.rb index c99d59edaa64fb2d606f75c8359eeb8f5da0c59b..5935049dcfc31251200ddb66afc49c9457128486 100644 --- a/spec/controllers/activitypub/followers_synchronizations_controller_spec.rb +++ b/spec/controllers/activitypub/followers_synchronizations_controller_spec.rb @@ -34,10 +34,9 @@ RSpec.describe ActivityPub::FollowersSynchronizationsController, type: :controll end context 'with signature from example.com' do - subject(:body) { body_as_json } - subject(:response) { get :show, params: { account_username: account.username } } + let(:body) { body_as_json } let(:remote_account) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/instance') } it 'returns http success' do diff --git a/spec/controllers/activitypub/outboxes_controller_spec.rb b/spec/controllers/activitypub/outboxes_controller_spec.rb index 167bbcc21d0bc43727515bfc5e8c7784aeb5478d..189b46a7d25752fff12d5dbe0eb054889a82779c 100644 --- a/spec/controllers/activitypub/outboxes_controller_spec.rb +++ b/spec/controllers/activitypub/outboxes_controller_spec.rb @@ -35,10 +35,9 @@ RSpec.describe ActivityPub::OutboxesController, type: :controller do describe 'GET #show' do context 'without signature' do - subject(:body) { body_as_json } - subject(:response) { get :show, params: { account_username: account.username, page: page } } + let(:body) { body_as_json } let(:remote_account) { nil } context 'with page not requested' do diff --git a/spec/controllers/api/web/embeds_controller_spec.rb b/spec/controllers/api/web/embeds_controller_spec.rb index e03f5a37142028fb1dd6f5240d9f441347f47889..b0c48a5aed3b9520b8753214d417c901d289ff3a 100644 --- a/spec/controllers/api/web/embeds_controller_spec.rb +++ b/spec/controllers/api/web/embeds_controller_spec.rb @@ -10,10 +10,10 @@ describe Api::Web::EmbedsController do before { sign_in user } describe 'POST #create' do - subject(:response) { post :create, params: { url: url } } - subject(:body) { JSON.parse(response.body, symbolize_names: true) } + let(:response) { post :create, params: { url: url } } + context 'when successfully finds status' do let(:status) { Fabricate(:status) } let(:url) { "http://#{Rails.configuration.x.web_domain}/@#{status.account.username}/#{status.id}" } diff --git a/spec/controllers/emojis_controller_spec.rb b/spec/controllers/emojis_controller_spec.rb index 710d23d92435bbc70dd0704f3fb810672bba3a35..249dfd9d51187335608dc14c10cbc2bac295ad02 100644 --- a/spec/controllers/emojis_controller_spec.rb +++ b/spec/controllers/emojis_controller_spec.rb @@ -8,10 +8,10 @@ describe EmojisController do let(:emoji) { Fabricate(:custom_emoji) } describe 'GET #show' do - subject(:response) { get :show, params: { id: emoji.id, format: :json } } - subject(:body) { JSON.parse(response.body, symbolize_names: true) } + let(:response) { get :show, params: { id: emoji.id, format: :json } } + it 'returns the right response' do expect(response).to have_http_status 200 expect(body[:name]).to eq ':coolcat:' diff --git a/spec/controllers/follower_accounts_controller_spec.rb b/spec/controllers/follower_accounts_controller_spec.rb index 0551dfcdec9353cbbd051f313641656b16551113..b5b8ff9cb4319f13a5f5991bfa2aa120dab56491 100644 --- a/spec/controllers/follower_accounts_controller_spec.rb +++ b/spec/controllers/follower_accounts_controller_spec.rb @@ -39,10 +39,10 @@ describe FollowerAccountsController do end context 'when format is json' do - subject(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } } - subject(:body) { response.parsed_body } + let(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } } + context 'with page' do let(:page) { 1 } diff --git a/spec/controllers/following_accounts_controller_spec.rb b/spec/controllers/following_accounts_controller_spec.rb index b049df890f35dbb5a157287fe0b7a2175f97e971..d1efeec25157f8882952de47af976308e37d68a5 100644 --- a/spec/controllers/following_accounts_controller_spec.rb +++ b/spec/controllers/following_accounts_controller_spec.rb @@ -39,10 +39,10 @@ describe FollowingAccountsController do end context 'when format is json' do - subject(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } } - subject(:body) { response.parsed_body } + let(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } } + context 'with page' do let(:page) { 1 }