8
我想用factory_girl寶石回形針但得到「沒有處理程序發現 錯誤」消息。與工廠女孩一起使用回形針,沒有圖像處理程序錯誤
test_should_update_category(CategoriesControllerTest): Paperclip::AdapterRegistry::NoHandlerError: No handler found for "/system/categories/images/000/000/001/original/tel1.JPG?1354197869"
工廠女孩文件:
FactoryGirl.define do
factory :category do
name "MyString"
description "MyText"
image { File.new(File.join(Rails.root, 'test','tel1.JPG')) }
end
end
類別移民:: ---------------
class CreateCategories < ActiveRecord::Migration
def up
create_table :categories do |t|
t.string :name
t.text :description
t.string :image
t.timestamps
end
add_attachment :categories, :image
end
型號:
class Category < ActiveRecord::Base
attr_accessible :description, :image, :name
has_attached_file :image, :styles => { :thumb => "100x100>" }
end
類別控制器測試文件:
require 'test_helper'
class CategoriesControllerTest < ActionController::TestCase
setup do
@category = FactoryGirl.create(:category)
end