0

Rails 3.2.2プロジェクトには、次のものがあります。

class Photo < ActiveRecord::Base
  belongs_to :album
  default_scope order: :title

  extend FriendlyId
  friendly_id :title, :use => :slugged
  validates :title, :presence => true
  validates :title, :uniqueness => {:scope => :album_id}
  validates :file, :attachment_presence => true

  has_attached_file :file, :path => (Rails.root + "photos/:id/:style/:filename").to_s,
                           :url => "/photos/:style/:id",
                           :styles => { :small => "450x450>"}
end

class PhotoTest < ActiveSupport::TestCase
  should belong_to(:album)

  should validate_presence_of(:title)
  should have_attached_file(:file)
  should validate_attachment_presence(:file)
end

'should validate_attachment_presence(:file)'テストは常に失敗しますが、理由がわかりません。必要なアタッチメントを使用して、問題なくテストできる他の単体テストがあります。

何か案は?

4

1 に答える 1

2

私にとっては、Paperclip 3.0.3 にアップグレードした後、問題は解消されました。バグは修正されたようです。

于 2012-05-05T17:03:33.040 に答える