Sha256: 41b0077d4439f9ae09b14b6abd571823f0438f4a126ef497abbbf7fd2cf3ace2

Contents?: true

Size: 1.07 KB

Versions: 13

Compression:

Stored size: 1.07 KB

Contents

# coding: utf-8

require 'spec_helper'

describe Locomotive::ContentAsset do

  describe 'attaching a file' do

    before(:each) do
      Locomotive::ContentAsset.any_instance.stubs(:site_id).returns('test')
      @asset = FactoryGirl.build(:asset)
    end

    it 'should process picture' do
      @asset.source = FixturedAsset.open('5k.png')
      @asset.source.file.content_type.should_not be_nil
      @asset.image?.should be_true
    end

    it 'should get width and height from the image' do
      @asset.source = FixturedAsset.open('5k.png')
      @asset.width.should == 32
      @asset.height.should == 32
    end

  end

  describe 'vignette' do

    before(:each) do
      @asset = FactoryGirl.build(:asset, source: FixturedAsset.open('5k.png'))
    end

    it 'does not resize image smaller than 50x50' do
      @asset.vignette_url.should =~ /^\/spec\/.*\/5k.png/
    end

    it 'has any possible resized versions' do
      @asset.stubs(:with).returns(90)
      @asset.stubs(:height).returns(90)
      @asset.vignette_url.should =~ /^\/images\/dynamic\/.*\/5k.png/
    end

  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
locomotive_cms-2.4.1 spec/models/locomotive/content_asset_spec.rb
locomotive_cms-2.4.0 spec/models/locomotive/content_asset_spec.rb
locomotive_cms-2.3.1 spec/models/locomotive/content_asset_spec.rb
locomotive_cms-2.3.0 spec/models/locomotive/content_asset_spec.rb
locomotive_cms-2.2.3 spec/models/locomotive/content_asset_spec.rb
locomotive_cms-2.2.2 spec/models/locomotive/content_asset_spec.rb
locomotive_cms-2.2.1 spec/models/locomotive/content_asset_spec.rb
locomotive_cms-2.2.0 spec/models/locomotive/content_asset_spec.rb
locomotive_cms-2.1.4 spec/models/locomotive/content_asset_spec.rb
locomotive_cms-2.1.3 spec/models/locomotive/content_asset_spec.rb
locomotive_cms-2.1.2 spec/models/locomotive/content_asset_spec.rb
locomotive_cms-2.1.1 spec/models/locomotive/content_asset_spec.rb
locomotive_cms-2.1.0 spec/models/locomotive/content_asset_spec.rb