Sha256: d235ef6ba18ff953b112fdd12cb8979c6e2ffb8784e34c7b88ae3af059ce9467

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'
require 'carrierwave/test/matchers'

describe PictureUploader do
  include CarrierWave::Test::Matchers
  
  before do
    PictureUploader.enable_processing = true
    @avatar = FactoryGirl.build(:asset_avatar, data: nil)
    @uploader = PictureUploader.new(@avatar, :data)
    @uploader.store!(File.open('spec/factories/files/rails.png'))
  end

  after do
    PictureUploader.enable_processing = false
  end
  
  context 'the thumb version' do
    it 'should scale down a landscape image to be exactly 100 by 100 pixels' do
      @uploader.thumb.should have_dimensions(80, 80)
    end
  end
  
  context 'manipulation' do
    it 'should strip image' do
      lambda {
        @uploader.strip
      }.should_not raise_error
    end
    
    it 'should set image quality' do
      lambda {
        @uploader.quality(80)
      }.should_not raise_error
    end
    
    it 'should rotate image' do
      lambda {
        @uploader.rotate(90)
      }.should_not raise_error
    end
    
    it 'should crop image' do
      lambda {
        @uploader.cropper(['50x60', '+5+5'])
      }.should_not raise_error
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ab_admin-0.3.6 spec/models/picture_uploader_spec.rb
ab_admin-0.3.5 spec/models/picture_uploader_spec.rb
ab_admin-0.3.4 spec/models/picture_uploader_spec.rb
ab_admin-0.3.3 spec/models/picture_uploader_spec.rb
ab_admin-0.3.2 spec/models/picture_uploader_spec.rb
ab_admin-0.3.1 spec/models/picture_uploader_spec.rb
ab_admin-0.3.0 spec/models/picture_uploader_spec.rb