Update rubocop-rspec to version 2.22.0, fix RSpec/IndexedLet cop (#24698)

This commit is contained in:
Matt Jankowski 2023-06-14 10:44:37 -04:00 committed by GitHub
parent 24015ef0cc
commit 4c5aa0e470
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 334 additions and 322 deletions

View file

@ -3,17 +3,17 @@
require 'rails_helper'
RSpec.describe ActivityPub::FollowersSynchronizationsController do
let!(:account) { Fabricate(:account) }
let!(:follower_1) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/users/a') }
let!(:follower_2) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/users/b') }
let!(:follower_3) { Fabricate(:account, domain: 'foo.com', uri: 'https://foo.com/users/a') }
let!(:follower_4) { Fabricate(:account, username: 'instance-actor', domain: 'example.com', uri: 'https://example.com') }
let!(:account) { Fabricate(:account) }
let!(:follower_example_com_user_a) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/users/a') }
let!(:follower_example_com_user_b) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/users/b') }
let!(:follower_foo_com_user_a) { Fabricate(:account, domain: 'foo.com', uri: 'https://foo.com/users/a') }
let!(:follower_example_com_instance_actor) { Fabricate(:account, username: 'instance-actor', domain: 'example.com', uri: 'https://example.com') }
before do
follower_1.follow!(account)
follower_2.follow!(account)
follower_3.follow!(account)
follower_4.follow!(account)
follower_example_com_user_a.follow!(account)
follower_example_com_user_b.follow!(account)
follower_foo_com_user_a.follow!(account)
follower_example_com_instance_actor.follow!(account)
allow(controller).to receive(:signed_request_actor).and_return(remote_account)
end
@ -47,7 +47,11 @@ RSpec.describe ActivityPub::FollowersSynchronizationsController do
it 'returns orderedItems with followers from example.com' do
expect(body[:orderedItems]).to be_an Array
expect(body[:orderedItems]).to contain_exactly(follower_4.uri, follower_1.uri, follower_2.uri)
expect(body[:orderedItems]).to contain_exactly(
follower_example_com_instance_actor.uri,
follower_example_com_user_a.uri,
follower_example_com_user_b.uri
)
end
it 'returns private Cache-Control header' do

View file

@ -7,9 +7,9 @@ RSpec.describe Admin::InstancesController do
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
let!(:account) { Fabricate(:account, domain: 'popular') }
let!(:account2) { Fabricate(:account, domain: 'popular') }
let!(:account3) { Fabricate(:account, domain: 'less.popular') }
let!(:account_popular_main) { Fabricate(:account, domain: 'popular') }
let!(:account_popular_other) { Fabricate(:account, domain: 'popular') }
let!(:account_less_popular) { Fabricate(:account, domain: 'less.popular') }
before do
sign_in current_user, scope: :user

View file

@ -5,13 +5,13 @@ require 'rails_helper'
describe FollowerAccountsController do
render_views
let(:alice) { Fabricate(:account) }
let(:follower0) { Fabricate(:account) }
let(:follower1) { Fabricate(:account) }
let(:alice) { Fabricate(:account, username: 'alice') }
let(:follower_bob) { Fabricate(:account, username: 'bob') }
let(:follower_chris) { Fabricate(:account, username: 'curt') }
describe 'GET #index' do
let!(:follow0) { follower0.follow!(alice) }
let!(:follow1) { follower1.follow!(alice) }
let!(:follow_from_bob) { follower_bob.follow!(alice) }
let!(:follow_from_chris) { follower_chris.follow!(alice) }
context 'when format is html' do
subject(:response) { get :index, params: { account_username: alice.username, format: :html } }

View file

@ -5,13 +5,13 @@ require 'rails_helper'
describe FollowingAccountsController do
render_views
let(:alice) { Fabricate(:account) }
let(:followee0) { Fabricate(:account) }
let(:followee1) { Fabricate(:account) }
let(:alice) { Fabricate(:account, username: 'alice') }
let(:followee_bob) { Fabricate(:account, username: 'bob') }
let(:followee_chris) { Fabricate(:account, username: 'chris') }
describe 'GET #index' do
let!(:follow0) { alice.follow!(followee0) }
let!(:follow1) { alice.follow!(followee1) }
let!(:follow_of_bob) { alice.follow!(followee_bob) }
let!(:follow_of_chris) { alice.follow!(followee_chris) }
context 'when format is html' do
subject(:response) { get :index, params: { account_username: alice.username, format: :html } }