$:.unshift File.join(File.dirname(__FILE__), "..", "lib") require 'xspf' require 'test/unit' class TestPlaylist < Test::Unit::TestCase def setup @playlist_document = < XSPlF it up! Mayhem & Chaos Coordinator Just a few songs to enjoy while you XSPlF it up! http://mayhem-chaos.net/xspf/xspf_it_up.html http://mayhem-chaos.net/xspf/xspf_it_up/1.0 ihttp://mayhem-chaos.net/xspf/xspf_it_up.html http://musicbrainz.org/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793 I Wanna Get High Cypress Hill 174613 http://musicbrainz.org/mm-2.1/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793 bdc846e7-6c26-4193-82a6-8d1b5a4d3429 Smoke Two Joints Sublime 175466 http://musicbrainz.org/mm-2.1/track/bdc846e7-6c26-4193-82a6-8d1b5a4d3429 http://musicbrainz.org/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58 Hash Pipe Weezer 186533 http://musicbrainz.org/mm-2.1/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58 END_OF_PLAYLIST xspf = XSPF.new(@playlist_document) @playlist = XSPF::Playlist.new(xspf) end def test_class assert_instance_of(XSPF::Playlist, @playlist) end def test_version assert_equal(@playlist.version, "0") end def test_xmlns assert_equal(@playlist.xmlns, "http://xspf.org/ns/0/") end def test_title assert_equal(@playlist.title, "XSPlF it up!") end def test_creator assert_equal(@playlist.creator, "Mayhem & Chaos Coordinator") end def test_annotation assert_equal(@playlist.annotation, "Just a few songs to enjoy while you XSPlF it up!") end def test_info assert_equal(@playlist.info, "http://mayhem-chaos.net/xspf/xspf_it_up.html") end def test_identifier assert_equal(@playlist.identifier, "http://mayhem-chaos.net/xspf/xspf_it_up/1.0") end def test_nil assert_nil(@playlist.image) end def test_error assert_raise(NoMethodError) { @playlist.inexistent_method } end end