J'écris un test unitaire pour un téléchargeur d'images utilisant un trombone. C'est d'être cahoteuse et je se déplaçait lentement pensé les obstacles jusqu'à ce que je me suis coincé dans la paperclip :: classe géométrieComment créer un test unitaire pour Paperclip :: Geometry?
Voici mon code ci-dessous
require 'test_helper'
require File.join(File.dirname(__FILE__),"../../config/initializers","paperclip")
class PhotoTest < ActiveSupport::TestCase
#include ActionController::TestProcess
should_belong_to(:product)
should_have_attached_file :data
setup do
#I had to do this way because the include right below the class line was not working
image = Photo.create(:data => ActionController::TestUploadedFile.new(ActionController::TestCase.fixture_path + "base-production-pack.png",'image/png'))
@geo = Paperclip::Geometry.from_file(image)
end
end
la paperclip :: géométrie me donne l'erreur:
test: Photo should have a paperclip attachment named #data. (PhotoTest):
Paperclip::NotIdentifiedByImageMagickError: #<Photo:0x1054aa6b8> is not recognized by the 'identify' command.
paperclip (2.3.6) lib/paperclip/geometry.rb:24:in `from_file'
/test/unit/photo_test.rb:13
Je dispose d'un fichier d'initialisation « de paperclip.rb » qui pointe à l'identifier sur ma machine locale
Merci d'avance