From 7fed4a974096ddbbbf23f8b0bb2b672f922b8b47 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 15 Apr 2024 11:24:31 -0400 Subject: [PATCH] Pull out repeated setup to shared setup in statusus/show view spec (#29927) --- spec/views/statuses/show.html.haml_spec.rb | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/spec/views/statuses/show.html.haml_spec.rb b/spec/views/statuses/show.html.haml_spec.rb index c74377d985a..1c408db6c5e 100644 --- a/spec/views/statuses/show.html.haml_spec.rb +++ b/spec/views/statuses/show.html.haml_spec.rb @@ -3,22 +3,23 @@ require 'rails_helper' 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 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_ago) 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) assign(:status, status) assign(:account, alice) assign(:descendant_threads, []) + end + it 'has valid opengraph tags' do render expect(header_tags) @@ -29,14 +30,6 @@ describe 'statuses/show.html.haml', :without_verify_partial_doubles do end 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 expect(header_tags)