Sha256: 77ecd440e193836cfd4b6ec307335ceb99b02f75f73caa107bf3285e30814b3b

Contents?: true

Size: 1.12 KB

Versions: 10

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe M3u8::MapItem do
  it 'should provide m3u8 format representation' do
    hash = { uri: 'frelo/prog_index.m3u8',
             byterange: {
               length: 4500,
               start: 600
             }
           }
    item = M3u8::MapItem.new(hash)
    output = item.to_s
    expected = '#EXT-X-MAP:URI="frelo/prog_index.m3u8",' \
               'BYTERANGE="4500@600"'
    expect(output).to eq expected

    hash = { uri: 'frehi/prog_index.m3u8' }
    item = M3u8::MapItem.new(hash)
    output = item.to_s
    expected = '#EXT-X-MAP:URI="frehi/prog_index.m3u8"'
    expect(output).to eq expected
  end

  it 'should parse m3u8 text into instance' do
    input = '#EXT-X-MAP:URI="frelo/prog_index.m3u8",' \
            'BYTERANGE="3500@300"'

    item = M3u8::MapItem.parse(input)

    expect(item.uri).to eq 'frelo/prog_index.m3u8'
    expect(item.byterange.length).to eq 3500
    expect(item.byterange.start).to eq 300

    input = '#EXT-X-MAP:URI="frelo/prog_index.m3u8"'

    item = M3u8::MapItem.parse(input)

    expect(item.uri).to eq 'frelo/prog_index.m3u8'
    expect(item.byterange).to be_nil
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
m3u8-0.7.0 spec/lib/m3u8/map_item_spec.rb
m3u8-0.6.9 spec/lib/m3u8/map_item_spec.rb
m3u8-0.6.8 spec/lib/m3u8/map_item_spec.rb
m3u8-0.6.7 spec/lib/m3u8/map_item_spec.rb
m3u8-0.6.6 spec/lib/m3u8/map_item_spec.rb
m3u8-0.6.5 spec/lib/m3u8/map_item_spec.rb
m3u8-0.6.4 spec/lib/m3u8/map_item_spec.rb
m3u8-0.6.3 spec/lib/m3u8/map_item_spec.rb
m3u8-0.6.2 spec/lib/m3u8/map_item_spec.rb
m3u8-0.6.1 spec/map_item_spec.rb