Sha256: be144233aae96c5e7ef9d8e0dbab5a0465022cd4a883be1856b28339237bb620

Contents?: true

Size: 1.2 KB

Versions: 8

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe FormatParser::JPEGParser do
  describe 'is able to parse all the examples from FastImage' do
    Dir.glob(fixtures_dir + '/*.jpg').each do |jpeg_path|
      it "is able to parse #{File.basename(jpeg_path)}" do
        parsed = subject.information_from_io(File.open(jpeg_path, 'rb'))
        expect(parsed).not_to be_nil
        expect(parsed.file_nature).to eq(:image)
        expect(parsed.file_type).to eq(:jpg)

        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
      end
    end
  end

  describe 'is able to parse all the JPEG exif examples from FastImage' do
    Dir.glob(fixtures_dir + '/exif-orientation-testimages/jpg/*.jpg').each do |jpeg_path|
      it "is able to parse #{File.basename(jpeg_path)}" do
        parsed = subject.information_from_io(File.open(jpeg_path, 'rb'))
        expect(parsed).not_to be_nil

        expect(parsed.orientation).to be_kind_of(Symbol)
        expect(parsed.width_px).to be > 0

        expect(parsed.height_px).to be_kind_of(Integer)
        expect(parsed.height_px).to be > 0
      end
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
format_parser-0.1.7 spec/parsers/jpeg_parser_spec.rb
format_parser-0.1.6 spec/parsers/jpeg_parser_spec.rb
format_parser-0.1.5 spec/parsers/jpeg_parser_spec.rb
format_parser-0.1.4 spec/parsers/jpeg_parser_spec.rb
format_parser-0.1.3 spec/parsers/jpeg_parser_spec.rb
format_parser-0.1.2 spec/parsers/jpeg_parser_spec.rb
format_parser-0.1.1 spec/parsers/jpeg_parser_spec.rb
format_parser-0.1.0 spec/parsers/jpeg_parser_spec.rb