Sha256: b2b52b99b8a5b79f6e3f80f9c0d49f49f6d104d5b9fc473a231a59e8ac7679d8

Contents?: true

Size: 1 KB

Versions: 4

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

describe Dragonfly::Encoding::RMagickEncoder do
  
  before(:all) do
    sample_file = File.dirname(__FILE__) + '/../../../samples/beach.png' # 280x355
    @image = Dragonfly::TempObject.new(File.new(sample_file))
    @encoder = Dragonfly::Encoding::RMagickEncoder.new
  end
  
  describe "#encode" do
    
    it "should encode the image to the correct format" do
      image = @encoder.encode(@image, :gif)
      image.should have_format('gif')
    end
    
    it "should throw :unable_to_handle if the format is not handleable" do
      lambda{
        @encoder.encode(@image, :goofy)
      }.should throw_symbol(:unable_to_handle)
    end
    
    it "should do nothing if the image is already in the correct format" do
      image = @encoder.encode(@image, :png)
      image.should == @image
    end
    
    it "should work when not using the filesystem" do
      @encoder.use_filesystem = false
      image = @encoder.encode(@image, :gif)
      image.should have_format('gif')
    end

  end
  
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
fog-dragonfly-0.8.2 spec/dragonfly/encoding/r_magick_encoder_spec.rb
fog-dragonfly-0.8.1 spec/dragonfly/encoding/r_magick_encoder_spec.rb
dragonfly-0.8.1 spec/dragonfly/encoding/r_magick_encoder_spec.rb
dragonfly-0.8.0 spec/dragonfly/encoding/r_magick_encoder_spec.rb