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.

33 lines
1.0 KiB

  1. require "rails_helper"
  2. describe "The webfinger route" do
  3. let(:alice) { Fabricate(:account, username: 'alice') }
  4. describe "requested without accepts headers" do
  5. it "returns a json response" do
  6. get webfinger_url, params: { resource: alice.to_webfinger_s }
  7. expect(response).to have_http_status(:success)
  8. expect(response.content_type).to eq "application/jrd+json"
  9. end
  10. end
  11. describe "requested with html in accepts headers" do
  12. it "returns a json response" do
  13. headers = { 'HTTP_ACCEPT' => 'text/html' }
  14. get webfinger_url, params: { resource: alice.to_webfinger_s }, headers: headers
  15. expect(response).to have_http_status(:success)
  16. expect(response.content_type).to eq "application/jrd+json"
  17. end
  18. end
  19. describe "requested with xml format" do
  20. it "returns an xml response" do
  21. get webfinger_url(resource: alice.to_webfinger_s, format: :xml)
  22. expect(response).to have_http_status(:success)
  23. expect(response.content_type).to eq "application/xrd+xml"
  24. end
  25. end
  26. end