Sha256: 3c57398fef24d89a3170a726098349f365c151080a9dd787ca256d6765236a2d

Contents?: true

Size: 1.31 KB

Versions: 14

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

describe Uploader::Fileuploads do
  before(:all) do
    @picture = FactoryGirl.create(:picture, assetable_type: 'Article')
  end

  it "should be a Module" do
    Uploader::Fileuploads.should be_a(Module)
  end

  context "instance methods" do
    before(:each) do
      @article = FactoryGirl.build(:article)
    end

    it "should return asset class" do
      @article.fileupload_klass("picture").should == Picture
    end

    it "should find asset by guid" do
      @picture.update_column(:guid, @article.fileupload_guid)

      asset = @article.fileupload_asset('picture')
      asset.should == @picture
    end

    it "should generate guid" do
      @article.fileupload_guid.should_not be_blank
    end

    it "should change guid" do
      @article.fileupload_guid = "other guid"
      @article.fileupload_changed?.should be_true
      @article.fileupload_guid.should == "other guid"
    end

    it "should not multiplay upload" do
      @article.fileupload_multiple?("picture").should be_false
    end

    it "should find uploaded asset or build new record" do
      picture = @article.fileupload_asset(:picture)
      picture.should_not be_nil
      picture.should be_new_record
    end

    it 'must get fileupload params' do
      @article.fileupload_params(:picture).should_not be nil
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rails-uploader-0.5.7 spec/fileuploads_spec.rb
rails-uploader-0.5.6 spec/fileuploads_spec.rb
rails-uploader-0.5.5 spec/fileuploads_spec.rb
rails-uploader-0.5.4 spec/fileuploads_spec.rb
rails-uploader-0.5.3 spec/fileuploads_spec.rb
rails-uploader-0.5.2 spec/fileuploads_spec.rb
rails-uploader-0.5.1 spec/fileuploads_spec.rb
rails-uploader-0.5.0 spec/fileuploads_spec.rb
rails-uploader-0.4.5 spec/fileuploads_spec.rb
rails-uploader-0.4.4 spec/fileuploads_spec.rb
rails-uploader-0.4.3 spec/fileuploads_spec.rb
rails-uploader-0.4.2 spec/fileuploads_spec.rb
rails-uploader-0.4.1 spec/fileuploads_spec.rb
rails-uploader-0.4.0 spec/fileuploads_spec.rb