Sha256: 549f7d99fc45162b0d04ab2c312dd8746cb43477c8a84c3f44237954d82c8d68

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe FormatParser::MP3Parser do
  it 'decodes and estimates duration for a VBR MP3' do
    fpath = fixtures_dir + '/MP3/atc_fixture_vbr.mp3'
    parsed = subject.information_from_io(File.open(fpath, 'rb'))

    expect(parsed).not_to be_nil

    expect(parsed.file_nature).to eq(:audio)
    expect(parsed.file_type).to eq(:mp3)
    expect(parsed.num_audio_channels).to eq(2)
    expect(parsed.audio_sample_rate_hz).to eq(44100)
    expect(parsed.intrinsics).not_to be_nil
    expect(parsed.media_duration_seconds).to be_within(0.1).of(0.836)
  end

  it 'decodes and estimates duration for a CBR MP3' do
    fpath = fixtures_dir + '/MP3/atc_fixture_cbr.mp3'
    parsed = subject.information_from_io(File.open(fpath, 'rb'))

    expect(parsed).not_to be_nil

    expect(parsed.file_nature).to eq(:audio)
    expect(parsed.file_type).to eq(:mp3)
    expect(parsed.num_audio_channels).to eq(2)
    expect(parsed.audio_sample_rate_hz).to eq(44100)
    expect(parsed.intrinsics).not_to be_nil
    expect(parsed.media_duration_seconds).to be_within(0.1).of(0.81)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
format_parser-0.1.5 spec/parsers/mp3_parser_spec.rb
format_parser-0.1.4 spec/parsers/mp3_parser_spec.rb
format_parser-0.1.3 spec/parsers/mp3_parser_spec.rb