The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

38 lines
1013 B

  1. require 'rails_helper'
  2. RSpec.describe Api::V1::ConversationsController, type: :controller 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: scopes) }
  6. let(:other) { Fabricate(:user, account: Fabricate(:account, username: 'bob')) }
  7. before do
  8. allow(controller).to receive(:doorkeeper_token) { token }
  9. end
  10. describe 'GET #index' do
  11. let(:scopes) { 'read:statuses' }
  12. before do
  13. PostStatusService.new.call(other.account, 'Hey @alice', nil, visibility: 'direct')
  14. end
  15. it 'returns http success' do
  16. get :index
  17. expect(response).to have_http_status(200)
  18. end
  19. it 'returns pagination headers' do
  20. get :index, params: { limit: 1 }
  21. expect(response.headers['Link'].links.size).to eq(2)
  22. end
  23. it 'returns conversations' do
  24. get :index
  25. json = body_as_json
  26. expect(json.size).to eq 1
  27. end
  28. end
  29. end