Mastodon/spec/views/statuses/show.html.haml_spec.rb
Claire e08c8b6933 Merge commit 'b48f907b20e2c9909665a484041845697d26f17c' into glitch-soc/merge-upstream
Conflicts:
- `app/helpers/settings_helper.rb`:
  Upstream added a new helper.
  Conflict caused by the fact there is a glitch-soc specific helper.
  Added upstream's new helper in addition to glitch-soc's.
2026-06-09 21:30:54 +02:00

54 lines
1.5 KiB
Ruby

# frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'statuses/show.html.haml' do
let(:alice) { Fabricate(:account, username: 'alice', display_name: 'Alice') }
let(:status) { Fabricate(:status, account: alice, text: 'Hello World') }
before do
view.extend view_helpers
assign(:instance_presenter, InstancePresenter.new)
Fabricate(:media_attachment, account: alice, status: status, type: :video)
assign(:status, status)
assign(:account, alice)
assign(:descendant_threads, [])
end
it 'has valid opengraph tags and twitter player tags' do
render
expect(header_tags)
.to match(/<meta content=".+" property="og:title">/)
.and include('<meta content="article" property="og:type">')
.and match(/<meta content=".+" property="og:image">/)
.and match(%r{<meta content="http://.+" property="og:url">})
expect(header_tags)
.to match(%r{<meta content="http://.+/media/.+/player" property="twitter:player">})
.and include('<meta content="player" property="twitter:card">')
end
def header_tags
view.content_for(:header_tags)
end
def view_helpers
Module.new do
def api_oembed_url(_) = ''
def show_landing_strip? = true
def site_title = 'example site'
def site_hostname = 'example.com'
def full_asset_url(_) = '//asset.host/image.svg'
def current_account = nil
def current_flavour = 'glitch'
def single_user_mode? = false
def local_time = nil
def local_time_ago = nil
end
end
end