Sha256: a78c3e5048a4307798c436c97b4b00ab68159ee2b9d938408a757db8efb20768
Contents?: true
Size: 1.67 KB
Versions: 1
Compression:
Stored size: 1.67 KB
Contents
require_relative '../../test_helper' describe DMAPParser::Builder do before do @pair_data = DMAPParser::Builder.cmpa do cmpg 'AABBCCDDEE' cmnm 'Name' cmty 'iPod' end end it 'should return a valid string' do dmap = @pair_data.to_dmap dmap.must_be_instance_of String DMAPParser::Parser.parse(dmap).to_dmap.must_equal(dmap) end it 'should raise an exception if tags are put inside non-containers' do lambda do DMAPParser::Builder.cmnm do cmpg 'AABBCCDDEE' cmty 'iPod' end end.must_raise RuntimeError end it 'should return a TagContainer' do @pair_data.must_be_instance_of DMAPParser::TagContainer end it 'should store the correct values' do @pair_data.cmpg.must_equal 'AABBCCDDEE' @pair_data.cmnm.must_equal 'Name' @pair_data.cmty.must_equal 'iPod' end it 'should store the correct Tags' do @pair_data.get_tag(:cmpg).must_be_instance_of DMAPParser::Tag @pair_data.get_tag(:cmnm).must_be_instance_of DMAPParser::Tag @pair_data.get_tag(:cmty).must_be_instance_of DMAPParser::Tag end it 'should fail if there is no container' do -> { DMAPParser::Builder.cmnm }.must_raise RuntimeError end it 'should support deep nesting' do nested = DMAPParser::Builder.mcon do miid 0 mcon do miid 1 mcon do miid 2 mcon do miid 3 end end end end nested.must_be_instance_of DMAPParser::TagContainer mcon = nested 3.times do |i| mcon.miid.must_equal i mcon = mcon.mcon end dmap = nested.to_dmap DMAPParser::Parser.parse(dmap).to_dmap.must_equal(dmap) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dmapparser-0.0.1 | test/lib/dmapparser/builder_test.rb |