I’m using Paperclip to store documents, but I can’t find how to create fixtures of them, I wrote this :
<% doc = Document.create(:asset => File.open(Rails.root.join('spec', 'assets', 'image.png'))) %>
<%= part_event_image %>:
asset_file_name: <%= doc.asset_file_name %>
asset_content_type: <%= doc.asset_content_type %>
asset_file_size: <%= doc.asset_file_size %>
asset_updated_at: <%= doc.asset_updated_at %>
documentable: party (Event) %>
<% end %>
But one I ran it, the document exist in the database, but it’s not stored.
Should I store the document myself (write the file) ? Or is there an other way ?
You can do with
fixture_file_uploador with factory girl