我正在使用回形针宝石上传图像。
我有一个看起来像这样的测试;
describe Person do
it { should have_attached_file(:image_one) }
end
在我的模型中,我有以下代码
class Person < ActiveRecord::Base
attr_accessible :first_name, :last_name, :gender, :story, :image_one
has_attached_file :image_one
end
测试仍然失败。
我的spec_helper文件中还有以下内容
require 'paperclip/matchers'
config.include Paperclip::Shoulda::Matchers
有什么我做错了吗?
对我来说,这是测试数据库方案不同步,rake db:test:load
解决了这个问题。