0
0
Fork 0

Change lists to be able to include accounts with pending follow requests (#19727)

This commit is contained in:
Claire 2023-05-02 14:40:36 +02:00 committed by GitHub
parent 598e63dad2
commit 6693a4fe7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 127 additions and 19 deletions

View file

@ -29,17 +29,48 @@ describe Api::V1::Lists::AccountsController do
let(:scopes) { 'write:lists' }
let(:bob) { Fabricate(:account, username: 'bob') }
before do
user.account.follow!(bob)
post :create, params: { list_id: list.id, account_ids: [bob.id] }
context 'when the added account is followed' do
before do
user.account.follow!(bob)
post :create, params: { list_id: list.id, account_ids: [bob.id] }
end
it 'returns http success' do
expect(response).to have_http_status(200)
end
it 'adds account to the list' do
expect(list.accounts.include?(bob)).to be true
end
end
it 'returns http success' do
expect(response).to have_http_status(200)
context 'when the added account has been sent a follow request' do
before do
user.account.follow_requests.create!(target_account: bob)
post :create, params: { list_id: list.id, account_ids: [bob.id] }
end
it 'returns http success' do
expect(response).to have_http_status(200)
end
it 'adds account to the list' do
expect(list.accounts.include?(bob)).to be true
end
end
it 'adds account to the list' do
expect(list.accounts.include?(bob)).to be true
context 'when the added account is not followed' do
before do
post :create, params: { list_id: list.id, account_ids: [bob.id] }
end
it 'returns http not found' do
expect(response).to have_http_status(404)
end
it 'does not add the account to the list' do
expect(list.accounts.include?(bob)).to be false
end
end
end