Sha256: e7eac658b6ff669da5e074133928af63758b02a0525bfeb9646407f39568427e

Contents?: true

Size: 798 Bytes

Versions: 4

Compression:

Stored size: 798 Bytes

Contents

# frozen_string_literal: true
require 'spec_helper'

describe do
  let(:test_class) { Class.new { extend M3u8 } }

  it 'should parse attributes to hash' do
    line = %(TEST-ID="Help",URI="http://test",ID=33\n)
    hash = test_class.parse_attributes line
    expect(hash['TEST-ID']).to eq 'Help'
    expect(hash['URI']).to eq 'http://test'
    expect(hash['ID']).to eq '33'
  end

  it 'should parse yes/no string' do
    value = 'YES'
    expect(test_class.parse_yes_no(value)).to be true
    value = 'NO'
    expect(test_class.parse_yes_no(value)).to be false
  end

  describe '#to_yes_no' do
    it 'converts true to YES' do
      expect(test_class.to_yes_no(true)).to eq('YES')
    end

    it 'converts false to NO' do
      expect(test_class.to_yes_no(false)).to eq('NO')
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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