Pull out repeated setup to shared setup in statusus/show view spec (#29927)

main
Matt Jankowski 2024-04-15 11:24:31 -04:00 committed by GitHub
parent 4117c8f6b8
commit 7fed4a9740
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 12 deletions

View File

@ -3,22 +3,23 @@
require 'rails_helper' require 'rails_helper'
describe 'statuses/show.html.haml', :without_verify_partial_doubles do describe 'statuses/show.html.haml', :without_verify_partial_doubles do
let(:alice) { Fabricate(:account, username: 'alice', display_name: 'Alice') }
let(:status) { Fabricate(:status, account: alice, text: 'Hello World') }
before do before do
allow(view).to receive_messages(api_oembed_url: '', site_title: 'example site', site_hostname: 'example.com', full_asset_url: '//asset.host/image.svg', current_account: nil, single_user_mode?: false) allow(view).to receive_messages(api_oembed_url: '', site_title: 'example site', site_hostname: 'example.com', full_asset_url: '//asset.host/image.svg', current_account: nil, single_user_mode?: false)
allow(view).to receive(:local_time) allow(view).to receive(:local_time)
allow(view).to receive(:local_time_ago) allow(view).to receive(:local_time_ago)
assign(:instance_presenter, InstancePresenter.new) assign(:instance_presenter, InstancePresenter.new)
end
it 'has valid opengraph tags' do
alice = Fabricate(:account, username: 'alice', display_name: 'Alice')
status = Fabricate(:status, account: alice, text: 'Hello World')
Fabricate(:media_attachment, account: alice, status: status, type: :video) Fabricate(:media_attachment, account: alice, status: status, type: :video)
assign(:status, status) assign(:status, status)
assign(:account, alice) assign(:account, alice)
assign(:descendant_threads, []) assign(:descendant_threads, [])
end
it 'has valid opengraph tags' do
render render
expect(header_tags) expect(header_tags)
@ -29,14 +30,6 @@ describe 'statuses/show.html.haml', :without_verify_partial_doubles do
end end
it 'has twitter player tag' do it 'has twitter player tag' do
alice = Fabricate(:account, username: 'alice', display_name: 'Alice')
status = Fabricate(:status, account: alice, text: 'Hello World')
Fabricate(:media_attachment, account: alice, status: status, type: :video)
assign(:status, status)
assign(:account, alice)
assign(:descendant_threads, [])
render render
expect(header_tags) expect(header_tags)