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.5.16 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.5.15 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.5.14 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.5.13 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.5.12 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.5.11 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.5.10 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.5.9 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.5.8 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.5.7 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.5.6 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.5.5 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.5.2 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.5.1 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.5.0 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.4.2 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.4.1 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.4.0 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.3.9 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb
classiccms-0.3.8 vendor/bundle/gems/dragonfly-0.9.12/spec/dragonfly/job_definitions_spec.rb