test/test_album.rb in meta-spotify-0.3.2 vs test/test_album.rb in meta-spotify-0.3.3

- old
+ new

@@ -14,11 +14,11 @@ end should "be available anywhere" do assert @worldwide_album.is_available_in?('UK') end end - + context "searching for an album name" do setup do FakeWeb.register_uri(:get, "http://ws.spotify.com/search/1/album?q=foo", :body => fixture_file("album_search.xml")) @@ -42,11 +42,11 @@ assert_equal 100, @results[:items_per_page] assert_equal 0, @results[:start_index] assert_equal 6, @results[:total_results] end end - + context "looking up a album" do setup do FakeWeb.register_uri(:get, "http://ws.spotify.com/lookup/1/?uri=#{CGI.escape ALBUM_URI}", :body => fixture_file("album.xml")) @@ -73,17 +73,36 @@ assert_raises MetaSpotify::URIError do MetaSpotify::Album.lookup(TRACK_URI) end end end + + context "looking up an album with just an upc code" do + setup do + FakeWeb.register_uri(:get, + "http://ws.spotify.com/lookup/1/?uri=#{CGI.escape ALBUM_ONE_UPC_URI}", + :body => fixture_file("album_one_upc.xml")) + @result = MetaSpotify::Album.lookup(ALBUM_ONE_UPC_URI) + end + should "fetch an album and return an album object" do + assert_kind_of MetaSpotify::Album, @result + assert_equal "Aleph", @result.name + assert_equal ALBUM_ONE_UPC_URI, @result.uri + assert_equal "2013", @result.released + assert_equal "825646397471", @result.upc + assert_equal '3MiiF9utmtGnLVITgl0JP7', @result.spotify_id + assert_equal 'http://open.spotify.com/album/3MiiF9utmtGnLVITgl0JP7', @result.http_uri + end + end + context "looking up an album with extra details" do setup do FakeWeb.register_uri(:get, "http://ws.spotify.com/lookup/1/?extras=trackdetail&uri=#{CGI.escape ALBUM_URI}", :body => fixture_file('album_with_trackdetail.xml')) @result = MetaSpotify::Album.lookup(ALBUM_URI, :extras => 'trackdetail') end - + should "fetch an album and return an object with more detailed track information" do assert_kind_of MetaSpotify::Album, @result assert_kind_of MetaSpotify::Track, @result.tracks.first assert_equal 'Rendez-vu', @result.tracks.first.name end \ No newline at end of file