Sha256: 93923e9d4be1d72beb73c7cb75faba50bc6b748bff3bc79e70e4855c77f34b75

Contents?: true

Size: 764 Bytes

Versions: 4

Compression:

Stored size: 764 Bytes

Contents

# frozen_string_literal: true
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

4 entries across 4 versions & 1 rubygems

Version Path
m3u8-0.8.2 spec/lib/m3u8/byte_range_spec.rb
m3u8-0.8.1 spec/lib/m3u8/byte_range_spec.rb
m3u8-0.8.0 spec/lib/m3u8/byte_range_spec.rb
m3u8-0.7.1 spec/lib/m3u8/byte_range_spec.rb