test/test_artist.rb in meta-spotify-0.2.0 vs test/test_artist.rb in meta-spotify-0.3.0
- old
+ new
@@ -9,16 +9,22 @@
: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 0.89217, @results[:artists].first.popularity
- assert_equal 1, @results[:query][:start_page]
- assert_equal 'request', @results[:query][:role]
- assert_equal "foo", @results[:query][:search_terms]
+
+ artist = @results[:artists].first
+ assert_kind_of MetaSpotify::Artist, artist
+ assert_equal "Foo Fighters", artist.name
+ assert_equal 0.89217, artist.popularity
+ assert_equal '7jy3rLJdDQY21OgRLCZ9sD', artist.spotify_id
+ assert_equal 'http://open.spotify.com/artist/7jy3rLJdDQY21OgRLCZ9sD', artist.http_uri
+
+ query = @results[:query]
+ assert_equal 1, query[:start_page]
+ assert_equal 'request', query[:role]
+ assert_equal "foo", query[:search_terms]
assert_equal 100, @results[:items_per_page]
assert_equal 0, @results[:start_index]
assert_equal 9, @results[:total_results]
end
end
@@ -30,15 +36,21 @@
@results = MetaSpotify::Artist.search('1200 Micrograms')
end
should "still return a list of results, for consistency" do
assert_kind_of Array, @results[:artists]
assert_equal 1, @results[:artists].length
- assert_kind_of MetaSpotify::Artist, @results[:artists].first
- assert_equal "1200 Micrograms", @results[:artists].first.name
- assert_equal 0.48196, @results[:artists].first.popularity
- assert_equal 1, @results[:query][:start_page]
- assert_equal 'request', @results[:query][:role]
- assert_equal "1200 Micrograms", @results[:query][:search_terms]
+
+ artist = @results[:artists].first
+ assert_kind_of MetaSpotify::Artist, artist
+ assert_equal "1200 Micrograms", artist.name
+ assert_equal 0.48196, artist.popularity
+ assert_equal '3AUNfvctGVnEOGZiAh0JIK', artist.spotify_id
+ assert_equal 'http://open.spotify.com/artist/3AUNfvctGVnEOGZiAh0JIK', artist.http_uri
+
+ query = @results[:query]
+ assert_equal 1, query[:start_page]
+ assert_equal 'request', query[:role]
+ assert_equal "1200 Micrograms", query[:search_terms]
assert_equal 100, @results[:items_per_page]
assert_equal 0, @results[:start_index]
assert_equal 1, @results[:total_results]
end
end
\ No newline at end of file