Sha256: a1d1a8acf0163ec2954de533cacb22b20c5b0d985e9a9a5d9f24980694a995d9

Contents?: true

Size: 1.33 KB

Versions: 58

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe Dragonfly::JobDefinitions do

  describe "defining jobs" do

    before(:each) do
      @job_definitions = Dragonfly::JobDefinitions.new
      @object = Object.new
      @object.extend @job_definitions
    end

    describe "a simple job" do

      before(:each) do
        @job_definitions.add :thumb do |size|
          process :thumb, size
        end
      end

      it "correctly call job steps" do
        @object.should_receive(:process).with(:thumb, '30x30#').and_return(job=mock)
        @object.thumb('30x30#').should == job
      end

      it "should correctly call job steps when bang is given" do
        @object.should_receive(:process!).with(:thumb, '30x30#').and_return(@object)
        @object.thumb!('30x30#').should == @object
      end

    end

  end
  
  
  describe "#definition_names" do
    
    before(:each) do
      @job_definitions = Dragonfly::JobDefinitions.new
      @object = Object.new
      @object.extend @job_definitions
    end
    
    it "should provide an empty list when no jobs have been defined" do
      @job_definitions.definition_names.should == []
    end
    
    it "should contain the job name when one is defined" do
      @job_definitions.add :foo do |size|
        process :thumb, size
      end
      @job_definitions.definition_names.should eq [:foo]
    end
    
  end
  
end

Version data entries

58 entries across 58 versions & 2 rubygems

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