我并不真正关心测试文件上传,但由于我在我的模型中有validates_attachment_presence等,因此rspec抱怨.
@attr = { :name => "value for name",:title => "value for title",:content => "value for content",:pic_file_name => "example.jpg",:pic_content_type => "image/jpg",:pic_file_size => "8192",:pic_updated_at => nil }
但这不起作用.
我发现了这个:http://fr.ivolo.us/posts/mocking-paperclip-with-rspec
所以我尝试过这样的事情:
Post.should_receive(:save_attached_files).and_return(true)
哪个也行不通.我该如何安抚RSpec?