闭社主体 forked from https://github.com/tootsuite/mastodon
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.

42 lines
1.5 KiB

  1. require 'rails_helper'
  2. describe 'accounts/show.html.haml' do
  3. before do
  4. allow(view).to receive(:show_landing_strip?).and_return(true)
  5. end
  6. it 'has an h-feed with correct number of h-entry objects in it' do
  7. alice = Fabricate(:account, username: 'alice', display_name: 'Alice')
  8. status = Fabricate(:status, account: alice, text: 'Hello World')
  9. status2 = Fabricate(:status, account: alice, text: 'Hello World Again')
  10. status3 = Fabricate(:status, account: alice, text: 'Are You Still There World?')
  11. assign(:account, alice)
  12. assign(:statuses, alice.statuses)
  13. assign(:stream_entry, status.stream_entry)
  14. assign(:type, status.stream_entry.activity_type.downcase)
  15. render
  16. expect(Nokogiri::HTML(rendered).search('.h-feed .h-entry').size).to eq 3
  17. end
  18. it 'has valid opengraph tags' do
  19. alice = Fabricate(:account, username: 'alice', display_name: 'Alice')
  20. status = Fabricate(:status, account: alice, text: 'Hello World')
  21. assign(:account, alice)
  22. assign(:statuses, alice.statuses)
  23. assign(:stream_entry, status.stream_entry)
  24. assign(:type, status.stream_entry.activity_type.downcase)
  25. render
  26. header_tags = view.content_for(:header_tags)
  27. expect(header_tags).to match(%r{<meta content='.+' property='og:title'>})
  28. expect(header_tags).to match(%r{<meta content='profile' property='og:type'>})
  29. expect(header_tags).to match(%r{<meta content='.+' property='og:image'>})
  30. expect(header_tags).to match(%r{<meta content='http://.+' property='og:url'>})
  31. end
  32. end