Disable paperclip processing in specs (#25359)
This commit is contained in:
		@@ -2,7 +2,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
require 'rails_helper'
 | 
					require 'rails_helper'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RSpec.describe MediaAttachment do
 | 
					RSpec.describe MediaAttachment, paperclip_processing: true do
 | 
				
			||||||
  describe 'local?' do
 | 
					  describe 'local?' do
 | 
				
			||||||
    subject { media_attachment.local? }
 | 
					    subject { media_attachment.local? }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -94,6 +94,12 @@ RSpec.configure do |config|
 | 
				
			|||||||
    stub_jsonld_contexts!
 | 
					    stub_jsonld_contexts!
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  config.before(:each) do |example|
 | 
				
			||||||
 | 
					    unless example.metadata[:paperclip_processing]
 | 
				
			||||||
 | 
					      allow_any_instance_of(Paperclip::Attachment).to receive(:post_process).and_return(true) # rubocop:disable RSpec/AnyInstance
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  config.after :each do
 | 
					  config.after :each do
 | 
				
			||||||
    Rails.cache.clear
 | 
					    Rails.cache.clear
 | 
				
			||||||
    redis.del(redis.keys)
 | 
					    redis.del(redis.keys)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ shared_examples 'AccountAvatar' do |fabricator|
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe 'base64-encoded files' do
 | 
					  describe 'base64-encoded files', paperclip_processing: true do
 | 
				
			||||||
    let(:base64_attachment) { "data:image/jpeg;base64,#{Base64.encode64(attachment_fixture('attachment.jpg').read)}" }
 | 
					    let(:base64_attachment) { "data:image/jpeg;base64,#{Base64.encode64(attachment_fixture('attachment.jpg').read)}" }
 | 
				
			||||||
    let(:account) { Fabricate(fabricator, avatar: base64_attachment) }
 | 
					    let(:account) { Fabricate(fabricator, avatar: base64_attachment) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
# frozen_string_literal: true
 | 
					# frozen_string_literal: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
shared_examples 'AccountHeader' do |fabricator|
 | 
					shared_examples 'AccountHeader' do |fabricator|
 | 
				
			||||||
  describe 'base64-encoded files' do
 | 
					  describe 'base64-encoded files', paperclip_processing: true do
 | 
				
			||||||
    let(:base64_attachment) { "data:image/jpeg;base64,#{Base64.encode64(attachment_fixture('attachment.jpg').read)}" }
 | 
					    let(:base64_attachment) { "data:image/jpeg;base64,#{Base64.encode64(attachment_fixture('attachment.jpg').read)}" }
 | 
				
			||||||
    let(:account) { Fabricate(fabricator, header: base64_attachment) }
 | 
					    let(:account) { Fabricate(fabricator, header: base64_attachment) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user