Sha256: aabd288c3d2720f726dcd91d3a517f0e7fa0586c9747bac71b77f9f5d928253f

Contents?: true

Size: 805 Bytes

Versions: 4

Compression:

Stored size: 805 Bytes

Contents

# frozen_string_literal: true
require 'spec_helper'

describe M3u8::TimeItem do
  it 'should provide m3u8 format representation' do
    options = { time: '2010-02-19T14:54:23.031' }
    item = M3u8::TimeItem.new(options)
    output = item.to_s
    expected = '#EXT-X-PROGRAM-DATE-TIME:2010-02-19T14:54:23.031'
    expect(output).to eq expected

    options = { time: Time.iso8601('2010-02-19T14:54:23.031Z') }
    item = M3u8::TimeItem.new(options)
    output = item.to_s
    expected = '#EXT-X-PROGRAM-DATE-TIME:2010-02-19T14:54:23Z'
    expect(output).to eq expected
  end

  it 'should parse m3u8 text into instance' do
    input = '#EXT-X-PROGRAM-DATE-TIME:2010-02-19T14:54:23.031Z'
    item = M3u8::TimeItem.parse(input)
    expect(item.time).to eq Time.iso8601('2010-02-19T14:54:23.031Z')
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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