Sha256: 7ea6ae65804d2f53b085c5c1965949b28ef3007e9170dbc9e00f39945f9b32bf

Contents?: true

Size: 970 Bytes

Versions: 3

Compression:

Stored size: 970 Bytes

Contents

# encoding: utf-8
require 'spec_helper'
require 'backgrounder/workers/store_asset'

describe worker = CarrierWave::Workers::StoreAsset do
  before do
    @user   = mock('User')
    @image  = mock('UserAsset')
    @worker = worker.new(@user, '22', :image)
  end

  context "#perform" do
    it 'processes versions' do
      File.expects(:open).with('../fixtures/test.jpg').once.returns('apple')
      FileUtils.expects(:rm).with('../fixtures/test.jpg').once
      @user.expects(:find).with('22').once.returns(@user)
      @user.expects(:image_tmp).once.returns('test.jpg')
      @user.expects(:image).once.returns(@image)
      @image.expects(:root).once.returns('..')
      @image.expects(:cache_dir).once.returns('fixtures')
      @user.expects(:process_image_upload=).with(true).once
      @user.expects(:image=).with('apple').once
      @user.expects(:image_tmp=).with(nil).once
      @user.expects(:save!).once.returns(true)

      @worker.perform
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
carrierwave_backgrounder-0.0.5 spec/workers/store_asset_spec.rb
carrierwave_backgrounder-0.0.4 spec/workers/store_asset_spec.rb
carrierwave_backgrounder-0.0.3 spec/workers/store_asset_spec.rb