Add coverage for `Account.followable_by` scope (#28689)

th-downstream
Matt Jankowski 10 months ago committed by GitHub
parent d7e13e2483
commit 0a7cff53c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1009,4 +1009,27 @@ RSpec.describe Account do
expect(subject.reload.followers_count).to eq 15 expect(subject.reload.followers_count).to eq 15
end end
end end
describe '.followable_by' do
context 'with follows and follow requests' do
let!(:account) { Fabricate(:account) }
let!(:eligible_account) { Fabricate(:account) }
let!(:following_account) { Fabricate(:account) }
let!(:follow_requested_account) { Fabricate(:account) }
before do
Fabricate :follow, account: account, target_account: following_account
Fabricate :follow_request, account: account, target_account: follow_requested_account
end
it 'returns accounts not already following or requested to follow' do
results = described_class.followable_by(account)
expect(results)
.to include(eligible_account)
.and not_include(following_account)
.and not_include(follow_requested_account)
end
end
end
end end

Loading…
Cancel
Save