Merge remote-tracking branch 'parent/main' into kbtopic-remove-quote
This commit is contained in:
commit
80542ea172
76 changed files with 658 additions and 390 deletions
|
@ -70,7 +70,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
|
||||
|
@ -94,7 +94,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
|
||||
|
|
|
@ -70,7 +70,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
|
||||
|
@ -94,7 +94,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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -20,11 +20,9 @@ RSpec.describe CreateFeaturedTagService do
|
|||
context 'with a remote account' do
|
||||
let(:account) { Fabricate(:account, domain: 'host.example') }
|
||||
|
||||
it 'creates a new featured tag and does not distributes' do
|
||||
it 'raises argument error' do
|
||||
expect { subject.call(account, tag) }
|
||||
.to change(FeaturedTag, :count).by(1)
|
||||
expect(ActivityPub::AccountRawDistributionWorker)
|
||||
.to_not have_enqueued_sidekiq_job(any_args)
|
||||
.to raise_error ArgumentError
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -128,7 +128,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) }
|
||||
|
||||
|
@ -145,7 +145,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) }
|
||||
|
||||
|
|
|
@ -23,13 +23,9 @@ RSpec.describe RemoveFeaturedTagService do
|
|||
context 'when called by a non local account' do
|
||||
let(:account) { Fabricate(:account, domain: 'host.example') }
|
||||
|
||||
it 'destroys the featured tag and does not send a distribution' do
|
||||
subject.call(account, featured_tag)
|
||||
|
||||
expect { featured_tag.reload }
|
||||
.to raise_error(ActiveRecord::RecordNotFound)
|
||||
expect(ActivityPub::AccountRawDistributionWorker)
|
||||
.to_not have_enqueued_sidekiq_job(any_args)
|
||||
it 'raises argument error' do
|
||||
expect { subject.call(account, featured_tag) }
|
||||
.to raise_error(ArgumentError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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) }
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue