2014-11-05 78 views
0

我正在忙於在將文檔發送到其他服務的應用程序中測試Paperclip。但是,我注意到在測試期間,我的規範/文檔文件夾開始填滿單元測試的附件。我知道這與我的配置有關,但我似乎無法弄清楚爲什麼它將文件放在這個文件夾中或者如何防止它發生。如何防止Paperclip將附件存儲在spec文件夾中?

if Rails.env.production? 
Paperclip::Attachment.default_options.merge!({ 
    ... 
}) 
elsif Rails.env.test? 
    Paperclip::Attachment.default_options.merge!({ 
    storage: :filesystem, 
    url: "/test_attachments", 
    path: ":rails_root/spec:url" 
    }) 
else 
    Paperclip::Attachment.default_options.merge!({ 
    storage: :filesystem, 
    url: "/uploads/:class/:attachment/:id_partition/:style/:filename", 
    path: ":rails_root/public:url" 
    }) 
end 

有什麼想法?我希望有一些配置選項可以讓我在測試環境中禁用存儲,但是我一直無法找到任何配置。

回答

相關問題