Fix notifications in UI, added new API for fetching account relationships
This commit is contained in:
parent
4bec613897
commit
e46abc71ca
11 changed files with 91 additions and 17 deletions
|
@ -71,4 +71,46 @@ RSpec.describe Api::AccountsController, type: :controller do
|
|||
expect(user.account.following?(other_account)).to be false
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #relationships' do
|
||||
let(:simon) { Fabricate(:user, email: 'simon@example.com', account: Fabricate(:account, username: 'simon')).account }
|
||||
let(:lewis) { Fabricate(:user, email: 'lewis@example.com', account: Fabricate(:account, username: 'lewis')).account }
|
||||
|
||||
before do
|
||||
user.account.follow!(simon)
|
||||
lewis.follow!(user.account)
|
||||
end
|
||||
|
||||
context 'provided only one ID' do
|
||||
before do
|
||||
get :relationships, params: { id: simon.id }
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
|
||||
it 'returns JSON with correct data' do
|
||||
json = body_as_json
|
||||
|
||||
expect(json).to be_a Enumerable
|
||||
expect(json.first[:following]).to be true
|
||||
expect(json.first[:followed_by]).to be false
|
||||
end
|
||||
end
|
||||
|
||||
context 'provided multiple IDs' do
|
||||
before do
|
||||
get :relationships, params: { id: [simon.id, lewis.id] }
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
|
||||
xit 'returns JSON with correct data' do
|
||||
# todo
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue