Sha256: eef11f3f127e6c06c51aa6d99237f835b7eded91e5eb377b5ba10a1aec29a08f

Contents?: true

Size: 734 Bytes

Versions: 10

Compression:

Stored size: 734 Bytes

Contents

require 'spec_helper'

describe M3u8::ByteRange do
  it 'should provide m3u8 format representation' do
    hash = { length: 4500, start: 600 }
    item = M3u8::ByteRange.new(hash)
    output = item.to_s
    expected = '4500@600'
    expect(output).to eq expected

    hash = { length: 3300 }
    item = M3u8::ByteRange.new(hash)
    output = item.to_s
    expected = '3300'
    expect(output).to eq expected
  end

  it 'should parse instance from string' do
    input = '3500@300'
    range = M3u8::ByteRange.parse(input)
    expect(range.length).to eq 3500
    expect(range.start).to eq 300

    input = '4000'
    range = M3u8::ByteRange.parse(input)
    expect(range.length).to eq 4000
    expect(range.start).to be_nil
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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