2
0

Update rubocop-rspec to version 3.6.0 (#34497)

This commit is contained in:
Matt Jankowski
2025-04-24 10:56:13 -04:00
committed by GitHub
parent 22ec828951
commit 6463415e06
41 changed files with 223 additions and 228 deletions

View File

@@ -68,7 +68,7 @@ RSpec.describe ActivityPub::FetchRemoteAccountService do
expect(account.domain).to eq 'example.com'
end
include_examples 'sets profile data'
it_behaves_like 'sets profile data'
end
context 'when WebFinger presents different domain than URI' do
@@ -91,7 +91,7 @@ RSpec.describe ActivityPub::FetchRemoteAccountService do
expect(account.domain).to eq 'iscool.af'
end
include_examples 'sets profile data'
it_behaves_like 'sets profile data'
end
context 'when WebFinger returns a different URI' do

View File

@@ -68,7 +68,7 @@ RSpec.describe ActivityPub::FetchRemoteActorService do
expect(account.domain).to eq 'example.com'
end
include_examples 'sets profile data'
it_behaves_like 'sets profile data'
end
context 'when WebFinger presents different domain than URI' do
@@ -91,7 +91,7 @@ RSpec.describe ActivityPub::FetchRemoteActorService do
expect(account.domain).to eq 'iscool.af'
end
include_examples 'sets profile data'
it_behaves_like 'sets profile data'
end
context 'when WebFinger returns a different URI' do

View File

@@ -115,7 +115,7 @@ RSpec.describe BulkImportRowService do
account.follow!(target_account)
end
include_examples 'row import success and list addition'
it_behaves_like 'row import success and list addition'
end
context 'when the user already requested to follow the target account' do
@@ -123,17 +123,17 @@ RSpec.describe BulkImportRowService do
account.request_follow!(target_account)
end
include_examples 'row import success and list addition'
it_behaves_like 'row import success and list addition'
end
context 'when the target account is neither followed nor requested' do
include_examples 'row import success and list addition'
it_behaves_like 'row import success and list addition'
end
context 'when the target account is the user themself' do
let(:target_account) { account }
include_examples 'row import success and list addition'
it_behaves_like 'row import success and list addition'
end
def add_target_account_to_list
@@ -153,7 +153,7 @@ RSpec.describe BulkImportRowService do
end
context 'when the list does not exist yet' do
include_examples 'common behavior'
it_behaves_like 'common behavior'
end
context 'when the list exists' do
@@ -161,7 +161,7 @@ RSpec.describe BulkImportRowService do
Fabricate(:list, account: account, title: list_name)
end
include_examples 'common behavior'
it_behaves_like 'common behavior'
it 'does not create a new list' do
account.follow!(target_account)

View File

@@ -71,7 +71,7 @@ RSpec.describe DeleteAccountService do
let!(:remote_alice) { Fabricate(:account, inbox_url: 'https://alice.com/inbox', domain: 'alice.com', protocol: :activitypub) }
let!(:remote_bob) { Fabricate(:account, inbox_url: 'https://bob.com/inbox', domain: 'bob.com', protocol: :activitypub) }
include_examples 'common behavior' do
it_behaves_like 'common behavior' do
let(:account) { Fabricate(:account) }
let(:local_follower) { Fabricate(:account) }
@@ -88,7 +88,7 @@ RSpec.describe DeleteAccountService do
stub_request(:post, account.inbox_url).to_return(status: 201)
end
include_examples 'common behavior' do
it_behaves_like 'common behavior' do
let(:account) { Fabricate(:account, inbox_url: 'https://bob.com/inbox', protocol: :activitypub, domain: 'bob.com') }
let(:local_follower) { Fabricate(:account) }

View File

@@ -46,7 +46,7 @@ RSpec.describe SuspendAccountService do
json['type'] == 'Update' && json['actor'] == actor_id && json['object']['id'] == actor_id && json['object']['suspended']
end
include_examples 'common behavior' do
it_behaves_like 'common behavior' do
let!(:account) { Fabricate(:account) }
let!(:remote_follower) { Fabricate(:account, uri: 'https://alice.com', inbox_url: 'https://alice.com/inbox', protocol: :activitypub, domain: 'alice.com') }
let!(:remote_reporter) { Fabricate(:account, uri: 'https://bob.com', inbox_url: 'https://bob.com/inbox', protocol: :activitypub, domain: 'bob.com') }
@@ -72,7 +72,7 @@ RSpec.describe SuspendAccountService do
json['type'] == 'Reject' && json['actor'] == ActivityPub::TagManager.instance.uri_for(followee) && json['object']['actor'] == account.uri
end
include_examples 'common behavior' do
it_behaves_like 'common behavior' do
let!(:account) { Fabricate(:account, domain: 'bob.com', uri: 'https://bob.com', inbox_url: 'https://bob.com/inbox', protocol: :activitypub) }
let!(:local_followee) { Fabricate(:account) }

View File

@@ -3,7 +3,7 @@
require 'rails_helper'
RSpec.describe UnsuspendAccountService do
shared_context 'with common context' do
shared_context 'when account is unsuspended' do
subject { described_class.new.call(account) }
let!(:local_follower) { Fabricate(:user, current_sign_in_at: 1.hour.ago).account }
@@ -31,12 +31,13 @@ RSpec.describe UnsuspendAccountService do
stub_request(:post, 'https://bob.com/inbox').to_return(status: 201)
end
let!(:account) { Fabricate(:account) }
it 'does not change the “suspended” flag' do
expect { subject }.to_not change(account, :suspended?)
end
include_examples 'with common context' do
let!(:account) { Fabricate(:account) }
include_context 'when account is unsuspended' do
let!(:remote_follower) { Fabricate(:account, uri: 'https://alice.com', inbox_url: 'https://alice.com/inbox', protocol: :activitypub, domain: 'alice.com') }
let!(:remote_reporter) { Fabricate(:account, uri: 'https://bob.com', inbox_url: 'https://bob.com/inbox', protocol: :activitypub, domain: 'bob.com') }
@@ -65,8 +66,8 @@ RSpec.describe UnsuspendAccountService do
end
describe 'unsuspending a remote account' do
include_examples 'with common context' do
let!(:account) { Fabricate(:account, domain: 'bob.com', uri: 'https://bob.com', inbox_url: 'https://bob.com/inbox', protocol: :activitypub) }
include_context 'when account is unsuspended' do
let!(:account) { Fabricate(:account, domain: 'bob.com', uri: 'https://bob.com', inbox_url: 'https://bob.com/inbox', protocol: :activitypub) }
let!(:resolve_account_service) { instance_double(ResolveAccountService) }
before do