0
0
Fork 0

Add Account.matches_uri_prefix scope and use in activitypub/followers_synchronizations controller (#28820)

This commit is contained in:
Matt Jankowski 2024-01-22 08:55:37 -05:00 committed by GitHub
parent 7ecf7f5403
commit 18004bf227
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 1 deletions

View file

@ -835,6 +835,31 @@ RSpec.describe Account do
end
describe 'scopes' do
describe 'matches_uri_prefix' do
let!(:alice) { Fabricate :account, domain: 'host.example', uri: 'https://host.example/user/a' }
let!(:bob) { Fabricate :account, domain: 'top-level.example', uri: 'https://top-level.example' }
it 'returns accounts which start with the value' do
results = described_class.matches_uri_prefix('https://host.example')
expect(results.size)
.to eq(1)
expect(results)
.to include(alice)
.and not_include(bob)
end
it 'returns accounts which equal the value' do
results = described_class.matches_uri_prefix('https://top-level.example')
expect(results.size)
.to eq(1)
expect(results)
.to include(bob)
.and not_include(alice)
end
end
describe 'auditable' do
let!(:alice) { Fabricate :account }
let!(:bob) { Fabricate :account }