diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-10-13 15:27:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-13 15:27:19 +0200 |
commit | 5159ba26e485daaeded2288c1b02bd1e516e1ca6 (patch) | |
tree | 409023bc5a521a321205265d9c1d8fd6d3eb3273 /spec/views | |
parent | 8818622feb9454684e51cd9b977b967883779432 (diff) |
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
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/statuses/show.html.haml_spec.rb | 44 |
1 files changed, 32 insertions, 12 deletions
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{<meta content=".+" property="og:image" />}) expect(header_tags).to match(%r{<meta content="http://.+" property="og:url" />}) 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{<meta content="http://.+/media/.+/player" property="twitter:player" />}) + expect(header_tags).to match(%r{<meta content="player" property="twitter:card" />}) + end end |