我正在为使用回形针的图像上传器编写单元测试。它很颠簸,我慢慢地想着障碍,直到我被困在回形针::几何课上
这是我下面的代码
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
回形针::geometry 给了我错误:
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
我有一个初始化文件“paperclip.rb”,它指向我本地机器上的标识
提前致谢