Sha256: 6b163f21df4f764f36214a0585af0b7b34400ce843f8dbbc9f3aae681bac7bd1

Contents?: true

Size: 940 Bytes

Versions: 1

Compression:

Stored size: 940 Bytes

Contents

require 'spec_helper'

describe Dragonfly::Minimagick::Encoder do

  before(:all) do
    sample_file = SAMPLES_DIR + '/beach.png' # 280x355
    @image = Dragonfly::TempObject.new(File.new(sample_file))
    @encoder = Dragonfly::Minimagick::Encoder.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
      image = @encoder.encode(@image, :gif)
      image.should have_format('gif')
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dragonfly-minimagick-0.0.1 spec/dragonfly-minimagick/encoder_spec.rb