The documentation for Paperclip mentions that you can change the upload path for tests by placing the following code in the test.rb
environment file:
Paperclip::Attachment.default_options[:path] = "#{Rails.root}/spec/test_files/:class/:id_partition/:style.:extension"
The issue I'm having is that the Attachment has a path set in the model, that doesn't get overwritten:
has_attached_file :photo, path: ':attachment/:id/:style.:extension'
When I'm running the tests the files get uploaded to the /photo/
folder instead of /spec/test_files/
.
I can probably achieve this by writing a custom Paperclip adapter, but there must be an easier way.