search_spec.rb 641 B

1234567891011121314151617181920
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe 'Accounts Search 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:accounts' }
  7. let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
  8. describe 'GET /api/v1/accounts/search' do
  9. it 'returns http success' do
  10. get '/api/v1/accounts/search', params: { q: 'query' }, headers: headers
  11. expect(response).to have_http_status(200)
  12. expect(response.content_type)
  13. .to start_with('application/json')
  14. end
  15. end
  16. end