1
0
puyopuyotetr.is/spec/views/statuses/show.html.haml_spec.rb
Claire 5a55180b95 Merge commit 'fe04291af46d7cb9d3439fa73739b2ffb2b53d72' into glitch-soc/merge-upstream
Conflicts:
- `spec/lib/sanitize/config_spec.rb`:
  Upstream rewrote top-level `describe` calls to `RSpec.describe`, and
  glitch-soc had differences in the first few tests because of the wider
  subset of HTML it accepts.
  Changed `describe` to `RSpec.describe` as upstream did, keeping
  glitch-soc's tests.
2024-09-04 19:38:52 +02:00

58 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' do
render
expect(header_tags)
.to match(/<meta content=".+" property="og:title">/)
.and match(/<meta content="article" property="og:type">/)
.and match(/<meta content=".+" property="og:image">/)
.and match(%r{<meta content="http://.+" property="og:url">})
end
it 'has twitter player tag' do
render
expect(header_tags)
.to match(%r{<meta content="http://.+/media/.+/player" property="twitter:player">})
.and match(/<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