Sha256: ae64e2d98ccfdcc485e52fba6c7322d1bd55d6b2491d230f1950bac704465462

Contents?: true

Size: 1.1 KB

Versions: 16

Compression:

Stored size: 1.1 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Dragonfly::JobBuilder do

  describe "a multi-step job" do

    before(:each) do
      @job_builder = Dragonfly::JobBuilder.new do |size, format|
        process :thumb, size
        encode format unless format.nil?
      end
    end

    it "should correctly call job steps" do
      job = mock
      job.should_receive(:process).with(:thumb, '30x30#').and_return(job2=mock)
      job2.should_receive(:encode).with(:jpg).and_return(job3=mock)
      @job_builder.build(job, '30x30#', :jpg).should == job3
    end

    it "should work consistently with bang methods" do
      job = mock
      job.should_receive(:process!).with(:thumb, '30x30#').and_return(job)
      job.should_receive(:encode!).with(:jpg).and_return(job)
      @job_builder.build!(job, '30x30#', :jpg).should == job
    end

    it "should yield nil if the arg isn't passed in" do
      job = mock
      job.should_receive(:process).with(:thumb, '30x30#').and_return(job2=mock)
      job2.should_not_receive(:encode)
      @job_builder.build(job, '30x30#').should == job2
    end

  end
  
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
dragonfly-0.8.6 spec/dragonfly/job_builder_spec.rb
dragonfly-0.8.5 spec/dragonfly/job_builder_spec.rb
dragonfly-0.8.4 spec/dragonfly/job_builder_spec.rb
fog-dragonfly-0.8.2 spec/dragonfly/job_builder_spec.rb
dragonfly-0.8.2 spec/dragonfly/job_builder_spec.rb
fog-dragonfly-0.8.1 spec/dragonfly/job_builder_spec.rb
dragonfly-0.8.1 spec/dragonfly/job_builder_spec.rb
dragonfly-0.8.0 spec/dragonfly/job_builder_spec.rb
dragonfly-0.7.7 spec/dragonfly/job_builder_spec.rb
dragonfly-0.7.6 spec/dragonfly/job_builder_spec.rb
dragonfly-0.7.5 spec/dragonfly/job_builder_spec.rb
dragonfly-0.7.4 spec/dragonfly/job_builder_spec.rb
dragonfly-0.7.3 spec/dragonfly/job_builder_spec.rb
dragonfly-0.7.2 spec/dragonfly/job_builder_spec.rb
dragonfly-0.7.1 spec/dragonfly/job_builder_spec.rb
dragonfly-0.7.0 spec/dragonfly/job_builder_spec.rb