Add tests

This commit is contained in:
Claire 2021-09-21 14:05:42 +02:00
parent 062a9e3c79
commit e521eae200
1 changed files with 32 additions and 12 deletions

View File

@ -19,6 +19,7 @@ describe 'statuses/show.html.haml', without_verify_partial_doubles: true 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')
media = Fabricate(:media_attachment, account: alice, status: status, type: :video)
reply = Fabricate(:status, account: bob, thread: status, text: 'Hello Alice')
assign(:status, status)
@ -39,6 +40,7 @@ describe 'statuses/show.html.haml', without_verify_partial_doubles: true do
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')
@ -64,6 +66,7 @@ describe 'statuses/show.html.haml', without_verify_partial_doubles: true do
it 'has valid opengraph tags' 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)
@ -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