From 79b1841805f47cd3931bfdb7d51e1791529c3845 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 3 Sep 2024 11:23:57 -0400 Subject: [PATCH] Disable `without_verify_partial_doubles` in statuses/show view spec (#29132) --- spec/spec_helper.rb | 6 ------ spec/views/statuses/show.html.haml_spec.rb | 21 +++++++++++++++++---- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 248c2c4105..2d20239b27 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,12 +8,6 @@ RSpec.configure do |config| config.mock_with :rspec do |mocks| mocks.verify_partial_doubles = true - - config.around(:example, :without_verify_partial_doubles) do |example| - mocks.verify_partial_doubles = false - example.call - mocks.verify_partial_doubles = true - end end config.before :suite do diff --git a/spec/views/statuses/show.html.haml_spec.rb b/spec/views/statuses/show.html.haml_spec.rb index 1c408db6c5..fd08f2772d 100644 --- a/spec/views/statuses/show.html.haml_spec.rb +++ b/spec/views/statuses/show.html.haml_spec.rb @@ -2,14 +2,13 @@ require 'rails_helper' -describe 'statuses/show.html.haml', :without_verify_partial_doubles do +describe 'statuses/show.html.haml' 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) + view.extend view_helpers + assign(:instance_presenter, InstancePresenter.new) Fabricate(:media_attachment, account: alice, status: status, type: :video) @@ -40,4 +39,18 @@ describe 'statuses/show.html.haml', :without_verify_partial_doubles do def header_tags view.content_for(:header_tags) end + + def view_helpers + Module.new do + def api_oembed_url(_) = '' + def show_landing_strip? = true + def site_title = 'example site' + def site_hostname = 'example.com' + def full_asset_url(_) = '//asset.host/image.svg' + def current_account = nil + def single_user_mode? = false + def local_time = nil + def local_time_ago = nil + end + end end