Sha256: be976d0d7b25eda50ab092cbb98e80d8d45f8c7d2400baaf4cf299deaa67340d
Contents?: true
Size: 1.51 KB
Versions: 2
Compression:
Stored size: 1.51 KB
Contents
require 'helper' class TestArtist < Test::Unit::TestCase context "searching for an artist name" do setup do FakeWeb.register_uri(:get, "http://ws.spotify.com/search/1/artist?q=foo", :body => fixture_file("artist_search.xml")) @results = MetaSpotify::Artist.search('foo') end should "return a list of results and search meta" do assert_kind_of Array, @results[:artists] assert_kind_of MetaSpotify::Artist, @results[:artists].first assert_equal "Foo Fighters", @results[:artists].first.name assert_equal 1, @results[:query][:start_page] assert_equal 'request', @results[:query][:role] assert_equal "foo", @results[:query][:search_terms] assert_equal 100, @results[:items_per_page] assert_equal 0, @results[:start_index] assert_equal 9, @results[:total_results] end end context "looking up an artist" do setup do FakeWeb.register_uri(:get, "http://ws.spotify.com/lookup/1/?uri=#{CGI.escape(ARTIST_URI)}", :body => fixture_file("artist.xml")) @result = MetaSpotify::Artist.lookup(ARTIST_URI) end should "fetch an artist and return an artist object" do assert_kind_of MetaSpotify::Artist, @result assert_equal "Basement Jaxx", @result.name end should "fail trying to look up an album" do assert_raises MetaSpotify::URIError do MetaSpotify::Artist.lookup(ALBUM_URI) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
meta-spotify-0.1.1 | test/test_artist.rb |
meta-spotify-0.1.0 | test/test_artist.rb |