Sha256: 3bf3ffe7a24641c86480849e77345a81c7f86c843f5b9e4a740927e3ea7cda76

Contents?: true

Size: 1.23 KB

Versions: 71

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe 'Parsing esoteric files and files causing ambiguous detection' do
  it 'correctly parses the test .docx files as Office docs' do
    docx_path = fixtures_dir + '/ZIP/10.docx'
    result = FormatParser.parse(File.open(docx_path, 'rb'))
    expect(result).not_to be_nil
    expect(result.nature).to eq(:document)
  end

  it 'does not return a result for a Keynote file when it mistakes it for a JPEG, and does not raise any errors' do
    jpeg_path = fixtures_dir + '/JPEG/keynote_recognized_as_jpeg.key'
    result = FormatParser.parse(File.open(jpeg_path, 'rb'))
    expect(result.nature).to eq(:archive)
  end

  it 'does not pick up JPG album art within an MP3 as a JPEG file' do
    jpeg_path = fixtures_dir + '/MP3/ATC Fixture With Album Art.mp3'
    results = FormatParser.parse(File.open(jpeg_path, 'rb'), results: :all)
    expect(results).to be_one
    expect(results.first.nature).to eq(:audio)
  end

  it 'returns a result for JPEG file that causes many reads due to too many APP1 markers' do
    jpeg_path = fixtures_dir + '/JPEG/too_many_APP1_markers_surrogate.jpg'
    result = FormatParser.parse(File.open(jpeg_path, 'rb'))
    expect(result).not_to be_nil
    expect(result.nature).to eq(:image)
  end
end

Version data entries

71 entries across 71 versions & 1 rubygems

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