Sha256: 15d505544bc83840f9780f7d633427a9bdcaa7e7de1718f51b5a0a9e79827ac4

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

unless ENV['IGNORE_RMAGICK']

  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

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dragonfly-0.8.6 spec/dragonfly/encoding/r_magick_encoder_spec.rb
dragonfly-0.8.5 spec/dragonfly/encoding/r_magick_encoder_spec.rb
dragonfly-0.8.4 spec/dragonfly/encoding/r_magick_encoder_spec.rb
dragonfly-0.8.2 spec/dragonfly/encoding/r_magick_encoder_spec.rb