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.

31 lines
997 B

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