Skip to content

Commit

Permalink
Disable paperclip processing in specs (#25359)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski committed Jun 10, 2023
1 parent c81f595 commit c94bb9b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion spec/models/media_attachment_spec.rb
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'

RSpec.describe MediaAttachment do
RSpec.describe MediaAttachment, paperclip_processing: true do
describe 'local?' do
subject { media_attachment.local? }

Expand Down
6 changes: 6 additions & 0 deletions spec/rails_helper.rb
Expand Up @@ -94,6 +94,12 @@ def get(path, headers: nil, sign_with: nil, **args)
stub_jsonld_contexts!
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
Rails.cache.clear
redis.del(redis.keys)
Expand Down
2 changes: 1 addition & 1 deletion spec/support/examples/models/concerns/account_avatar.rb
Expand Up @@ -17,7 +17,7 @@
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(:account) { Fabricate(fabricator, avatar: base64_attachment) }

Expand Down
2 changes: 1 addition & 1 deletion spec/support/examples/models/concerns/account_header.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true

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(:account) { Fabricate(fabricator, header: base64_attachment) }

Expand Down

0 comments on commit c94bb9b

Please sign in to comment.