Add with_list_account scope to List model (#35539)

This commit is contained in:
Matt Jankowski 2025-07-28 04:26:29 -04:00 committed by GitHub
parent 018e5e303f
commit 7cd3738c19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 28 additions and 4 deletions

View file

@ -28,4 +28,26 @@ RSpec.describe List do
end
end
end
describe 'Scopes' do
describe '.with_list_account' do
let(:alice) { Fabricate :account }
let(:bob) { Fabricate :account }
let(:list) { Fabricate :list }
let(:other_list) { Fabricate :list }
before do
Fabricate :follow, account: list.account, target_account: alice
Fabricate :follow, account: other_list.account, target_account: bob
Fabricate :list_account, list: list, account: alice
Fabricate :list_account, list: other_list, account: bob
end
it 'returns lists connected to the account' do
expect(described_class.with_list_account(alice))
.to include(list)
.and not_include(other_list)
end
end
end
end