fakefs + paperclip on rails3 + rspec2 will give me an error "cannot generate tempfile"
rails (3.0.1)
fakefs (0.2.1) paperclip (2.3.4) rspec (2.0.1)I am testing my model with rspec. Since this is a test, I want to prevent any file creations under the public directory as paperclip normally does. I am thinking this workaround is to use fakefs.
Although I implemented this
http://trevorturk.com/2008/12/11/easy-upload-via-url-with-paperclip/
to be able to save an image from a remote url, if I don't put this line
include FakeFS::SpecHelpers
to activate fakefs in my rspec, it works fine (and DOES create files under public/system..., which I don't want for tests)
if I activate fakefs, for some reasons, I get an error such as
cannot generate tempfile `/tmp/stream20101027-704-开发者_如何学运维adna7o-9.gif'
at the method
def download_remote_image
self.image = do_download_remote_image
^ happening in this method
self.image_remote_url = image_url
end
/tmp permission is drwxrwxrwt, so I think anyone can write on it.
and here are my questions.
- Should I not use fakefs to test for paperclip related methods?
- Should I not care about the paperclip file creations for such tests? or there are any other ways to solve the problem?
精彩评论