From 5159ba26e485daaeded2288c1b02bd1e516e1ca6 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 13 Oct 2021 15:27:19 +0200 Subject: Fix error when rendering public pages with media attachments (#16763) * Add tests * Fix error when rendering public pages with media attachments * Add tests * Fix tests * Please CodeClimate --- spec/views/statuses/show.html.haml_spec.rb | 44 ++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 12 deletions(-) (limited to 'spec/views/statuses') diff --git a/spec/views/statuses/show.html.haml_spec.rb b/spec/views/statuses/show.html.haml_spec.rb index dbda3b665..879a26959 100644 --- a/spec/views/statuses/show.html.haml_spec.rb +++ b/spec/views/statuses/show.html.haml_spec.rb @@ -16,10 +16,11 @@ describe 'statuses/show.html.haml', without_verify_partial_doubles: true do end it 'has valid author h-card and basic data for a detailed_status' do - alice = Fabricate(:account, username: 'alice', display_name: 'Alice') - bob = Fabricate(:account, username: 'bob', display_name: 'Bob') - status = Fabricate(:status, account: alice, text: 'Hello World') - reply = Fabricate(:status, account: bob, thread: status, text: 'Hello Alice') + alice = Fabricate(:account, username: 'alice', display_name: 'Alice') + bob = Fabricate(:account, username: 'bob', display_name: 'Bob') + status = Fabricate(:status, account: alice, text: 'Hello World') + media = Fabricate(:media_attachment, account: alice, status: status, type: :video) + reply = Fabricate(:status, account: bob, thread: status, text: 'Hello Alice') assign(:status, status) assign(:account, alice) @@ -35,12 +36,13 @@ describe 'statuses/show.html.haml', without_verify_partial_doubles: true do end it 'has valid h-cites for p-in-reply-to and p-comment' do - alice = Fabricate(:account, username: 'alice', display_name: 'Alice') - bob = Fabricate(:account, username: 'bob', display_name: 'Bob') - carl = Fabricate(:account, username: 'carl', display_name: 'Carl') - status = Fabricate(:status, account: alice, text: 'Hello World') - reply = Fabricate(:status, account: bob, thread: status, text: 'Hello Alice') - comment = Fabricate(:status, account: carl, thread: reply, text: 'Hello Bob') + alice = Fabricate(:account, username: 'alice', display_name: 'Alice') + bob = Fabricate(:account, username: 'bob', display_name: 'Bob') + carl = Fabricate(:account, username: 'carl', display_name: 'Carl') + status = Fabricate(:status, account: alice, text: 'Hello World') + media = Fabricate(:media_attachment, account: alice, status: status, type: :video) + reply = Fabricate(:status, account: bob, thread: status, text: 'Hello Alice') + comment = Fabricate(:status, account: carl, thread: reply, text: 'Hello Bob') assign(:status, reply) assign(:account, alice) @@ -62,8 +64,9 @@ describe 'statuses/show.html.haml', without_verify_partial_doubles: true do end it 'has valid opengraph tags' do - alice = Fabricate(:account, username: 'alice', display_name: 'Alice') - status = Fabricate(:status, account: alice, text: 'Hello World') + alice = Fabricate(:account, username: 'alice', display_name: 'Alice') + status = Fabricate(:status, account: alice, text: 'Hello World') + media = Fabricate(:media_attachment, account: alice, status: status, type: :video) assign(:status, status) assign(:account, alice) @@ -78,4 +81,21 @@ describe 'statuses/show.html.haml', without_verify_partial_doubles: true do expect(header_tags).to match(%r{}) expect(header_tags).to match(%r{}) end + + it 'has twitter player tag' do + alice = Fabricate(:account, username: 'alice', display_name: 'Alice') + status = Fabricate(:status, account: alice, text: 'Hello World') + media = Fabricate(:media_attachment, account: alice, status: status, type: :video) + + assign(:status, status) + assign(:account, alice) + assign(:descendant_threads, []) + + render + + header_tags = view.content_for(:header_tags) + + expect(header_tags).to match(%r{}) + expect(header_tags).to match(%r{}) + end end -- cgit