From 19849eb91d1a7f8b5700abc50cbd84181666fa2c Mon Sep 17 00:00:00 2001
From: Matt Jankowski <matt@jankowski.online>
Date: Tue, 3 Sep 2024 11:39:19 -0400
Subject: [PATCH] Skip paperclip spoof detector unless opted into attachment
 processing specs (#31454)

---
 spec/rails_helper.rb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 883eaec84..0b24f68f7 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -147,7 +147,10 @@ RSpec.configure do |config|
 
   config.before do |example|
     unless example.metadata[:attachment_processing]
-      allow_any_instance_of(Paperclip::Attachment).to receive(:post_process).and_return(true) # rubocop:disable RSpec/AnyInstance
+      # rubocop:disable RSpec/AnyInstance
+      allow_any_instance_of(Paperclip::Attachment).to receive(:post_process).and_return(true)
+      allow_any_instance_of(Paperclip::MediaTypeSpoofDetector).to receive(:spoofed?).and_return(false)
+      # rubocop:enable RSpec/AnyInstance
     end
   end