Sha256: cdb90bb896b1c6267b51201bb6ff18cc945298191e3dd716e2ea83648a624580

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

describe FormatParser::M3UParser do
  let(:parsed_m3u) do
    subject.call(
      File.open(
        Pathname.new(fixtures_dir).join('M3U').join(m3u_file),
        'rb'
      )
    )
  end

  describe 'an m3u file with missing header' do
    let(:m3u_file) { 'invalid_plain_text.m3u' }

    it 'does not parse the file successfully' do
      expect(parsed_m3u).to be_nil
    end
  end

  describe 'an m3u file with valid header' do
    let(:m3u_file) { 'sample.m3u' }

    it 'parses the file successfully' do
      expect(parsed_m3u).not_to be_nil
      expect(parsed_m3u.nature).to eq(:text)
      expect(parsed_m3u.format).to eq(:m3u)
      expect(parsed_m3u.content_type).to eq('application/vnd.apple.mpegurl')
    end
  end

  describe 'an m3u8 file with valid header' do
    let(:m3u_file) { 'sample.m3u8' }

    it 'parses the file successfully' do
      expect(parsed_m3u).not_to be_nil
      expect(parsed_m3u.nature).to eq(:text)
      expect(parsed_m3u.format).to eq(:m3u)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
format_parser-2.10.0 spec/parsers/m3u_parser_spec.rb
format_parser-2.9.0 spec/parsers/m3u_parser_spec.rb
format_parser-2.8.0 spec/parsers/m3u_parser_spec.rb
format_parser-2.7.2 spec/parsers/m3u_parser_spec.rb
format_parser-2.7.1 spec/parsers/m3u_parser_spec.rb