Sha256: 8daf615b557d8a4b0249a8f8f670bfc901b0296062acf3678d6a32e63d16ecd9

Contents?: true

Size: 1.07 KB

Versions: 35

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe FormatParser::GIFParser do
  describe 'is able to parse all the examples from FastImage' do
    Dir.glob(fixtures_dir + '/*.gif').each do |gif_path|
      it "is able to parse #{File.basename(gif_path)}" do
        parsed = subject.call(File.open(gif_path, 'rb'))

        expect(parsed).not_to be_nil

        expect(parsed.nature).to eq(:image)
        expect(parsed.format).to eq(:gif)
        expect(parsed.color_mode).to eq(:indexed)

        expect(parsed.width_px).to be_kind_of(Integer)
        expect(parsed.width_px).to be > 0

        expect(parsed.height_px).to be_kind_of(Integer)
        expect(parsed.height_px).to be > 0
        expect(parsed.content_type).to eq('image/gif')
      end
    end
  end

  describe 'is able to correctly parse our own examples' do
    it 'is able to parse the animated GIF' do
      gif_path = fixtures_dir + 'GIF/anim.gif'

      parsed = subject.call(File.open(gif_path, 'rb'))
      expect(parsed).not_to be_nil

      expect(parsed.width_px).to eq(320)
      expect(parsed.height_px).to eq(180)
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
format_parser-2.10.0 spec/parsers/gif_parser_spec.rb
format_parser-2.9.0 spec/parsers/gif_parser_spec.rb
format_parser-2.8.0 spec/parsers/gif_parser_spec.rb
format_parser-2.7.2 spec/parsers/gif_parser_spec.rb
format_parser-2.7.1 spec/parsers/gif_parser_spec.rb
format_parser-2.7.0 spec/parsers/gif_parser_spec.rb
format_parser-2.6.0 spec/parsers/gif_parser_spec.rb
format_parser-2.5.0 spec/parsers/gif_parser_spec.rb
format_parser-2.4.5 spec/parsers/gif_parser_spec.rb
format_parser-2.4.4 spec/parsers/gif_parser_spec.rb
format_parser-2.4.3 spec/parsers/gif_parser_spec.rb
format_parser-2.3.0 spec/parsers/gif_parser_spec.rb
format_parser-2.2.1 spec/parsers/gif_parser_spec.rb
format_parser-2.2.0 spec/parsers/gif_parser_spec.rb
format_parser-2.1.0 spec/parsers/gif_parser_spec.rb
format_parser-2.0.0 spec/parsers/gif_parser_spec.rb
format_parser-2.0.0.pre.4 spec/parsers/gif_parser_spec.rb
format_parser-2.0.0.pre.3 spec/parsers/gif_parser_spec.rb
format_parser-2.0.0.pre.2 spec/parsers/gif_parser_spec.rb
format_parser-2.0.0.pre spec/parsers/gif_parser_spec.rb