webfinger_request_spec.rb 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe 'The webfinger route' do
  4. let(:alice) { Fabricate(:account, username: 'alice') }
  5. describe 'requested with standard accepts headers' do
  6. it 'returns a json response' do
  7. get webfinger_url(resource: alice.to_webfinger_s)
  8. expect(response).to have_http_status(200)
  9. expect(response.media_type).to eq 'application/jrd+json'
  10. end
  11. end
  12. describe 'asking for json format' do
  13. it 'returns a json response for json format' do
  14. get webfinger_url(resource: alice.to_webfinger_s, format: :json)
  15. expect(response).to have_http_status(200)
  16. expect(response.media_type).to eq 'application/jrd+json'
  17. end
  18. it 'returns a json response for json accept header' do
  19. headers = { 'HTTP_ACCEPT' => 'application/jrd+json' }
  20. get webfinger_url(resource: alice.to_webfinger_s), headers: headers
  21. expect(response).to have_http_status(200)
  22. expect(response.media_type).to eq 'application/jrd+json'
  23. end
  24. end
  25. end