show.html.haml_spec.rb 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe 'about/show.html.haml', without_verify_partial_doubles: true do
  4. before do
  5. allow(view).to receive(:site_hostname).and_return('example.com')
  6. allow(view).to receive(:site_title).and_return('example site')
  7. allow(view).to receive(:new_user).and_return(User.new)
  8. allow(view).to receive(:use_seamless_external_login?).and_return(false)
  9. end
  10. it 'has valid open graph tags' do
  11. instance_presenter = double(
  12. :instance_presenter,
  13. site_title: 'something',
  14. site_short_description: 'something',
  15. site_description: 'something',
  16. version_number: '1.0',
  17. source_url: 'https://github.com/tootsuite/mastodon',
  18. open_registrations: false,
  19. thumbnail: nil,
  20. hero: nil,
  21. mascot: nil,
  22. user_count: 420,
  23. status_count: 69,
  24. active_user_count: 420,
  25. contact_account: nil,
  26. sample_accounts: []
  27. )
  28. assign(:instance_presenter, instance_presenter)
  29. render
  30. header_tags = view.content_for(:header_tags)
  31. expect(header_tags).to match(%r{<meta content=".+" property="og:title" />})
  32. expect(header_tags).to match(%r{<meta content="website" property="og:type" />})
  33. expect(header_tags).to match(%r{<meta content=".+" property="og:image" />})
  34. expect(header_tags).to match(%r{<meta content="http://.+" property="og:url" />})
  35. end
  36. end