You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.5 KiB

  1. require 'rails_helper'
  2. describe Api::V1::Accounts::StatusesController do
  3. render_views
  4. let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
  5. let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:statuses') }
  6. before do
  7. allow(controller).to receive(:doorkeeper_token) { token }
  8. Fabricate(:status, account: user.account)
  9. end
  10. describe 'GET #index' do
  11. it 'returns http success' do
  12. get :index, params: { account_id: user.account.id, limit: 1 }
  13. expect(response).to have_http_status(200)
  14. expect(response.headers['Link'].links.size).to eq(2)
  15. end
  16. context 'with only media' do
  17. it 'returns http success' do
  18. get :index, params: { account_id: user.account.id, only_media: true }
  19. expect(response).to have_http_status(200)
  20. end
  21. end
  22. context 'with exclude replies' do
  23. before do
  24. Fabricate(:status, account: user.account, thread: Fabricate(:status))
  25. end
  26. it 'returns http success' do
  27. get :index, params: { account_id: user.account.id, exclude_replies: true }
  28. expect(response).to have_http_status(200)
  29. end
  30. end
  31. context 'with only pinned' do
  32. before do
  33. Fabricate(:status_pin, account: user.account, status: Fabricate(:status, account: user.account))
  34. end
  35. it 'returns http success' do
  36. get :index, params: { account_id: user.account.id, pinned: true }
  37. expect(response).to have_http_status(200)
  38. end
  39. end
  40. end
  41. end