Sha256: 3a558601740e87e7ff9e3ae603d49195e63cc86b00271333e5ffa5720d32d9ca

Contents?: true

Size: 1.07 KB

Versions: 60

Compression:

Stored size: 1.07 KB

Contents

require '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

60 entries across 60 versions & 3 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_builder_spec.rb
classiccms-0.7.4 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_builder_spec.rb
classiccms-0.7.3 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_builder_spec.rb
classiccms-0.7.2 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_builder_spec.rb
classiccms-0.7.1 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_builder_spec.rb
classiccms-0.7.0 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_builder_spec.rb
dragonfly-0.9.15 spec/dragonfly/job_builder_spec.rb
dragonfly-0.9.14 spec/dragonfly/job_builder_spec.rb
dragonfly-0.9.13 spec/dragonfly/job_builder_spec.rb
classiccms-0.6.9 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_builder_spec.rb
classiccms-0.6.8 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_builder_spec.rb
classiccms-0.6.7 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_builder_spec.rb
classiccms-0.6.6 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_builder_spec.rb
classiccms-0.6.5 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_builder_spec.rb
classiccms-0.6.4 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_builder_spec.rb
classiccms-0.6.3 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_builder_spec.rb
classiccms-0.6.2 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_builder_spec.rb
classiccms-0.6.1 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_builder_spec.rb
classiccms-0.6.0 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_builder_spec.rb
classiccms-0.5.17 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_builder_spec.rb