Sha256: 3d66a1d308c0db80bbbc7b72936e64819104fb62861fea32698b2a17c9d8111c
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'rspec' require 'active_record' require 'paperclip' require 'paperclip-dimension' # mocking Rails.root & Rails.env used in Paperclip::Interploration module Rails def self.root File.dirname(__FILE__) + "/.." end def self.env "test" end def self.logger nil end end ActiveRecord::Base.send(:include, Paperclip::Glue) # turn off logging Paperclip.options[:log] = false # use sqlite3 memory store ActiveRecord::Base.establish_connection({ :adapter => 'sqlite3', :database => ':memory:' }) # create tables ActiveRecord::Schema.define do create_table :posts do |t| t.attachment :image t.attachment :another_image end end # define model class Post < ActiveRecord::Base extend Paperclip::Dimension::ClassMethods has_attached_file :image, :styles => { :large => ['350x350>', :jpg], :medium => ['150x150>', :jpg], :small => ['30x30>', :jpg] } has_attached_file :another_image, :styles => { :large => ['350x350>', :jpg], :medium => ['150x150>', :jpg], :small => ['30x30>', :jpg] } end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
paperclip-dimension-0.2.0 | spec/spec_helper.rb |