lists_spec.rb 807 B

123456789101112131415161718192021222324252627
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe 'Accounts Lists API' do
  4. let(:user) { Fabricate(:user) }
  5. let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
  6. let(:scopes) { 'read:lists' }
  7. let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
  8. let(:account) { Fabricate(:account) }
  9. let(:list) { Fabricate(:list, account: user.account) }
  10. before do
  11. user.account.follow!(account)
  12. list.accounts << account
  13. end
  14. describe 'GET /api/v1/accounts/lists' do
  15. it 'returns http success' do
  16. get "/api/v1/accounts/#{account.id}/lists", headers: headers
  17. expect(response).to have_http_status(200)
  18. expect(response.content_type)
  19. .to start_with('application/json')
  20. end
  21. end
  22. end