Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
ApplicationUploader.enable_processing takes priority over SubclassedUploader.enable_processing #1349
I have an
require 'carrierwave/test/matchers' describe ApplicationUploader do include CarrierWave::Test::Matchers context "with a pdf" do before(:all) do puts "\n-- Testing Uploader: ApplicationUploader\n" ApplicationUploader.enable_processing = true @uploader = ApplicationUploader.new(Fabricate.build(:media_item), :attachment) @uploader.store!(File.open(Rails.root.join("spec", "support_files", "sample.pdf"))) end after(:all) do ApplicationUploader.enable_processing = false @uploader.remove! end # ... end end
require 'spec_helper' require 'carrierwave/test/matchers' describe DocumentUploader do include CarrierWave::Test::Matchers context "with a pdf" do before(:all) do puts "\n-- Testing Uploader: DocumentUploader\n" # ApplicationUploader.enable_processing = true DocumentUploader.enable_processing = true @uploader = DocumentUploader.new(Fabricate.build(:media_document), :attachment) @uploader.store!(File.open(Rails.root.join("spec", "support_files", "sample.pdf"))) end after(:all) do # ApplicationUploader.enable_processing = false DocumentUploader.enable_processing = false @uploader.remove! end end end
I believe this is also the case when using
I don't know if this is actually an issue - which is a better way to go - but I've spent a few hours racking my brain over this and thought that it should at least be documented somewhere. It seems like if I can toggle processing at the instance level, I should be able to toggle processing at the class level as well, rather than the parent class or configuration rule all.