Sha256: 078a4c7f03b161c2e6b411a71e103b0644ee748ee029dac825ee22f26987365d

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require 'rspec'
require 'mongoid'
require 'mongoid-paperclip'

ENV['MONGOID_ENV'] = 'test'
Mongoid.load!('./spec/config/mongoid.yml')

RSpec.configure do |config|
  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_content_type :avatar, content_type: /\Aimage\/.*\Z/
end

class MultipleAttachments
  include Mongoid::Document
  include Mongoid::Paperclip

  has_mongoid_attached_file :avatar
  validates_attachment_content_type :avatar, content_type: /\Aimage\/.*\Z/

  has_mongoid_attached_file :icon
  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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoid-paperclip-0.1.0 spec/spec_helper.rb