Sha256: 65159bc65fe7d8a09437d4d644b8113f7ae802e9448aa8ec83a9e48bea00cb6b
Contents?: true
Size: 983 Bytes
Versions: 6
Compression:
Stored size: 983 Bytes
Contents
require 'spec_helper' require 'mongoid' Mongoid.load!('spec/mongoid.yml', ENV['RAILS_ENV']) class MongoidArticle include Mongoid::Document include Uploader::Fileuploads has_one :mongoid_picture, :as => :assetable fileuploads :mongoid_picture end class MongoidPicture include Mongoid::Document include Uploader::Asset::Mongoid belongs_to :assetable, polymorphic: true end describe Uploader::Asset::Mongoid do before do @guid = 'guid' @picture = MongoidPicture.create!(:guid => @guid, :assetable_type => 'MongoidArticle') end it 'should find asset by guid' do asset = MongoidArticle.fileupload_find("mongoid_picture", @picture.guid) asset.should == @picture end it "should update asset target_id by guid" do MongoidArticle.fileupload_update(1000, @picture.guid, :mongoid_picture) @picture.reload @picture.assetable_id.should == 1000 @picture.guid.should be_nil end after do MongoidPicture.destroy_all end end
Version data entries
6 entries across 6 versions & 1 rubygems