The code powering m.abunchtell.com https://m.abunchtell.com
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

34 lignes
1015 B

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe 'Link headers' do
  4. describe 'on the account show page' do
  5. let(:account) { Fabricate(:account, username: 'test') }
  6. before do
  7. get short_account_path(username: account)
  8. end
  9. it 'contains webfinger url in link header' do
  10. link_header = link_header_with_type('application/xrd+xml')
  11. expect(link_header.href).to match 'http://www.example.com/.well-known/webfinger?resource=acct%3Atest%40cb6e6126.ngrok.io'
  12. expect(link_header.attr_pairs.first).to eq %w(rel lrdd)
  13. end
  14. it 'contains atom url in link header' do
  15. link_header = link_header_with_type('application/atom+xml')
  16. expect(link_header.href).to eq 'http://www.example.com/users/test.atom'
  17. expect(link_header.attr_pairs.first).to eq %w(rel alternate)
  18. end
  19. def link_header_with_type(type)
  20. response.headers['Link'].links.find do |link|
  21. link.attr_pairs.any? { |pair| pair == ['type', type] }
  22. end
  23. end
  24. end
  25. end