Sha256: ae3b32e1722cf0858d2c74c1ce9d2a3becd59bf36a2c1037f6025866022c650d

Contents?: true

Size: 1.39 KB

Versions: 6

Compression:

Stored size: 1.39 KB

Contents

require 'bundler/setup'
Bundler.require(:default)
require 'active_record'
require 'minitest/autorun'
require 'mocha/setup'

ActiveRecord::Base.establish_connection(
  adapter: "sqlite3",
  database: ":memory:"
)

if ENV["VERBOSE"]
  ActiveRecord::Base.logger = Logger.new(STDERR)
else
  Paperclip.options[:log] = false
end

load(File.join(File.dirname(__FILE__), 'schema.rb'))

ActiveRecord::Base.send(:include, Paperclip::Glue)
Paperclip::Meta::Railtie.insert

I18n.enforce_available_locales = true

class Image < ActiveRecord::Base
  has_attached_file :small_image,
    storage: :filesystem,
    path: "./spec/tmp/:style/:id.:extension",
    url: "./spec/tmp/:style/:id.extension"

  has_attached_file :big_image,
    storage: :filesystem,
    path: "./spec/tmp/fixtures/tmp/:style/:id.:extension",
    url: "./spec/tmp/fixtures/tmp/:style/:id.extension",
    styles: { thumb: "100x100#", large: "500x500#" }

  # paperclip 4.0 requires a validator
  validates_attachment_content_type :small_image, content_type: /\Aimage/
  validates_attachment_content_type :big_image, content_type: /\Aimage/
end

class ImageWithNoValidation < ActiveRecord::Base
  self.table_name = :images

  has_attached_file :small_image,
    storage: :filesystem,
    path: "./spec/tmp/:style/:id.:extension",
    url: "./spec/tmp/:style/:id.extension"

  if Paperclip::VERSION >= "4.0"
    do_not_validate_attachment_file_type :small_image
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
ack-paperclip-meta-1.2.3 spec/spec_helper.rb
ack-paperclip-meta-1.2.2 spec/spec_helper.rb
paperclip-meta-1.2.0 spec/spec_helper.rb
glebtv-paperclip-meta-1.2.1 spec/spec_helper.rb
glebtv-paperclip-meta-1.2.0 spec/spec_helper.rb
paperclip-meta-1.1.0 spec/spec_helper.rb