spec/spec_helper.rb in mongoid-paperclip-0.0.11 vs spec/spec_helper.rb in mongoid-paperclip-0.1.0

- old
+ new

@@ -9,23 +9,38 @@ config.before(:each) do Mongoid.purge! end end +# Mock Rails itself so Paperclip can write the attachments to a directory. +class Rails + def self.root + File.expand_path(File.dirname(__FILE__)) + end +end + class User include Mongoid::Document include Mongoid::Paperclip has_mongoid_attached_file :avatar - validates_attachment_file_name :avatar, matches: [/image/] + validates_attachment_content_type :avatar, content_type: /\Aimage\/.*\Z/ end class MultipleAttachments include Mongoid::Document include Mongoid::Paperclip has_mongoid_attached_file :avatar - validates_attachment_file_name :avatar, matches: [/image/] + validates_attachment_content_type :avatar, content_type: /\Aimage\/.*\Z/ has_mongoid_attached_file :icon - validates_attachment_file_name :avatar, matches: [/image/] + validates_attachment_content_type :icon, content_type: /\Aimage\/.*\Z/ +end + +class NoFingerprint + include Mongoid::Document + include Mongoid::Paperclip + + has_mongoid_attached_file :avatar, disable_fingerprint: true + validates_attachment_content_type :avatar, content_type: /\Aimage\/.*\Z/ end