Add with_list_account scope to List model (#35539)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user