attachment_fu Test Troubles
rake test:plugins PLUGIN=attachment_fu TESTOPTS=”-v”
attachment_fu’s tests hate me, or at least hate my MacBook.
Problems:
1. always whines about s3 even if i don’t want to use it
2. ImageWithThumbsClassFileAttachment fails it - says full_filename doesn’t exist
3. test_should_create_file_from_uploaded_file is reading a text file as a png
4. makes a sqlite database file in my root project directoy!
5. gives a weird error: unknown IO error whilst running rake
1 and 2 are fixable. http://beast.caboo.se/forums/2/topics/1074
3: I really did not understand this test failing. Opening a text file, checking if nil height - okay. Maybe a bug in my processing since it returns 612px width! Who knows.
4. Can be fixed by hardcoded sqlite to use an in memory database, but I could not get erb to run in the yaml file to give it a dynamic location. Doh!
5: This was a real head scratcher:
class MinimalAttachment < ActiveRecord::Base
has_attachment :path_prefix => ‘vendor/plugins/attachment_fu/test/files’, :processor => :rmagick
validates_as_attachment
def filename
“#{id}_file”
end
end
That fixes it. For some reason Tempfile gives an unknown IO error if the tempfile ends in .file
Can verify by editing attachment_fu.rb:
def random_tempfile_filename
"#{rand Time.now.to_i}#{filename || 'attachment'}.file"
end
and then get the errors. What?? I dug around some but just didn’t have time to really fix that.
I figure as long as I understand why the tests fails I’m okay. The only issue I found with any changes I made was using backward compatibility :file_system_path. I don’t use that.
2008 Update:
Rick does seem to be updating the code base to include these fixes. http://pastie.textmate.org/67051 Yay.
0 comments
Kick things off by filling out the form below.
Leave a Comment