host_meta_spec.rb 659 B

123456789101112131415161718192021222324252627
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe 'The /.well-known/host-meta request' do
  4. it 'returns http success with valid XML response' do
  5. get '/.well-known/host-meta'
  6. expect(response)
  7. .to have_http_status(200)
  8. .and have_attributes(
  9. media_type: 'application/xrd+xml',
  10. body: host_meta_xml_template
  11. )
  12. end
  13. private
  14. def host_meta_xml_template
  15. <<~XML
  16. <?xml version="1.0" encoding="UTF-8"?>
  17. <XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
  18. <Link rel="lrdd" template="https://cb6e6126.ngrok.io/.well-known/webfinger?resource={uri}"/>
  19. </XRD>
  20. XML
  21. end
  22. end