Sha256: 6762db7251ce694db480b16a00e49b2b0dbd6cd6b2526e328f907ccf2814c133
Contents?: true
Size: 1.46 KB
Versions: 27
Compression:
Stored size: 1.46 KB
Contents
# coding: utf-8 require 'spec_helper' describe Locomotive::ContentAsset do describe 'attaching a file' do let(:asset) { FactoryGirl.build(:asset, source: FixturedAsset.open('5k.png')) } before { allow_any_instance_of(Locomotive::ContentAsset).to receive(:site_id).and_return('test') } it 'should process picture' do expect(asset.source.file.content_type).to_not eq(nil) expect(asset.image?).to eq(true) end it 'should get width and height from the image' do expect(asset.width).to eq(32) expect(asset.height).to eq(32) end end describe 'vignette' do let(:asset) { FactoryGirl.build(:asset, source: FixturedAsset.open('5k.png')) } it 'does not resize image smaller than 50x50' do expect(asset.vignette_url).to match(/^\/spec\/.*\/5k.png/) end it 'has any possible resized versions' do allow(asset).to receive(:with).and_return(90) allow(asset).to receive(:height).and_return(90) expect(asset.vignette_url).to match(/^\/images\/dynamic\/.*\/5k.png/) end end describe 'attaching a pdf' do subject { FactoryGirl.build(:asset, source: FixturedAsset.open('specs.pdf')) } it { expect(subject.pdf?).to eq(true) } it { expect(subject.vignette_url).to match(/^\/images\/dynamic\/.*\/specs.png/) } end describe '#checksum' do let(:asset) { FactoryGirl.create(:asset, source: FixturedAsset.open('5k.png')) } it { expect(asset.checksum).not_to eq nil } end end
Version data entries
27 entries across 27 versions & 1 rubygems