ile yüklenen Paperclip dosyasının test edilmesi Dosya yüklemelerini test etmeyi gerçekten umursamıyorum, ancak modelimde validates_attachment_presence
vb. Varlığımdan dolayı rspec şikayet ediyor. Bu yüzden şimdi denemek ve onu susturmaya spec bu özelliklere sahip benim model oluşturma ediyorumRSpec
:
@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
}
Bu da, çalışmaz.
Post.should_receive(:save_attached_files).and_return(true)
ya çalışmaz: http://fr.ivolo.us/posts/mocking-paperclip-with-rspec Yani böyle bir şey denedim:
bunu buldum. RSpec'i nasıl rahatlatırım?
olası yinelenen http://stackoverflow.com/questions/2256012/unit-testing-paperclip-uploads-with-rspec- raylar –