I just added validations for a carrierwave image to a model and now tests run really slow. How can I speed up this process? I feel like there must be a better way.
I've been running without validations and used to be able to run through my rspec tests in about 140 seconds, but since i now validate presence of :display_pic
I've had to add real file uploads to my project factory. This has upped it to 240 seconds! 140 was already on the heavy side, this is just crazy.
This is how the carrierwave github page recommends setting up Factory Girl:
FactoryGirl.define do
factory :project do
display_pic { File.open(File.join(Rails.root, 'spec', 'support', 'projects', 'display_pics', 'test.jpg')) }
end
end
I made the above test.jpg just an empty text file, so its essentially as small a file as possible.
I also followed the carrierwave recommendation to setup testing:
CarrierWave.configure do |config|
config.storage = :file
config.enable_processing = false
end