I have a model called Photothat has an inscription paper clip attachment image.
I have working specifications that test the creation of a new photo with an attachment and can create them manually.
I have the following FactoryGirl factory used in all my specifications:
FactoryGirl.define do
factory :photo do
image { File.new(File.join(Rails.root, 'spec', 'fixtures', 'images', 'minimum.jpg')) }
end
end
I need to use attributes_for(:photo)to generate the attributes that need to be passed to the PhotoController create action, but at the same time Paperclip throws an error:
Paperclip::AdapterRegistry::NoHandlerError:
No handler found for "#<File:0x007f87c0a1d980>"
I see that if I create a new photo using a browser, the attribute imagelooks like this:
"image"=>#<ActionDispatch::Http::UploadedFile:0x007fbc480b1c18 @tempfile=#<Tempfile:/var/folders/bv/x495g9g10m7119680c9ssqmr0000gn/T/RackMultipart20140622-45603-a1h9a8>, @original_filename="equals_cover_art_old.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"photo[image]\"; filename=\"equals_cover_art_old.jpg\"\r\nContent-Type: image/jpeg\r\n">}
However, the image attribute generated attributes_for(:photo)is as follows:
:image=>
attributes_for(:photo) ?