Sha256: 3b35e0b37cb247f4a538e579db0fab89e98e0ee39cee32358b22aa29e1dd5d82

Contents?: true

Size: 956 Bytes

Versions: 7

Compression:

Stored size: 956 Bytes

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

7 entries across 7 versions & 1 rubygems

Version Path
format_parser-0.12.2 spec/esoteric_formats_spec.rb
format_parser-0.12.1 spec/esoteric_formats_spec.rb
format_parser-0.12.0 spec/esoteric_formats_spec.rb
format_parser-0.11.0 spec/esoteric_formats_spec.rb
format_parser-0.10.0 spec/esoteric_formats_spec.rb
format_parser-0.9.4 spec/esoteric_formats_spec.rb
format_parser-0.9.3 spec/esoteric_formats_spec.rb