spec/lib/rspotify/album_spec.rb in rspotify-1.16.1 vs spec/lib/rspotify/album_spec.rb in rspotify-1.17.0

- old
+ new

@@ -13,20 +13,21 @@ expect(@album.album_type) .to eq 'album' expect(@album.available_markets) .to include *%w(AD AT BE BG CA EE ES FR GR MC TW US) expect(@album.copyrights) .to include ({'text' => '2013 Domino Recording Co Ltd', 'type' => 'C'}) expect(@album.external_ids['upc']) .to eq '887828031795' expect(@album.external_urls['spotify']) .to eq 'https://open.spotify.com/album/5bU1XKYxHhEwukllT20xtk' - expect(@album.genres) .to be_an Array + expect(@album.genres) .to be_an Array expect(@album.href) .to eq 'https://api.spotify.com/v1/albums/5bU1XKYxHhEwukllT20xtk' expect(@album.id) .to eq '5bU1XKYxHhEwukllT20xtk' expect(@album.images) .to include ({'height' => 640, 'width' => 640, 'url' => 'https://i.scdn.co/image/4d9ec146e3a257b10634d9a413ef6cc3de325008'}) expect(@album.name) .to eq 'AM' expect(@album.popularity) .to be > 0 expect(@album.release_date) .to eq '2013-09-09' expect(@album.release_date_precision) .to eq 'day' expect(@album.type) .to eq 'album' expect(@album.uri) .to eq 'spotify:album:5bU1XKYxHhEwukllT20xtk' + expect(@album.total_tracks) .to eq 12 end it 'should find album with correct artists' do artists = @album.artists expect(artists) .to be_an Array @@ -45,19 +46,19 @@ end describe 'Album::find receiving array of ids' do it 'should find the right albums' do ids = ['2agWNCZl5Ts9W05mij8EPh'] - albums = VCR.use_cassette('album:find:2agWNCZl5Ts9W05mij8EPh') do + albums = VCR.use_cassette('album:find:2agWNCZl5Ts9W05mij8EPh') do RSpotify::Album.find(ids) end expect(albums) .to be_an Array expect(albums.size) .to eq 1 expect(albums.first.name) .to eq 'The Next Day Extra' ids << '3JquYMWj5wrzuZCNAvOYN9' - albums = VCR.use_cassette('album:find:3JquYMWj5wrzuZCNAvOYN9') do + albums = VCR.use_cassette('album:find:3JquYMWj5wrzuZCNAvOYN9') do RSpotify::Album.find(ids) end expect(albums) .to be_an Array expect(albums.size) .to eq 2 expect(albums.first.name) .to eq 'The Next Day Extra' @@ -75,57 +76,57 @@ RSpotify.authenticate(client_id, client_secret) end end it 'should find the appropriate new releases' do - albums = VCR.use_cassette('album:new_releases') do + albums = VCR.use_cassette('album:new_releases') do RSpotify::Album.new_releases end expect(albums.size) .to eq 20 expect(albums.map(&:name)) .to include('A13', 'Singles', 'Magic') end it 'should accept additional options' do - albums = VCR.use_cassette('album:new_releases:limit:10:offset:10') do + albums = VCR.use_cassette('album:new_releases:limit:10:offset:10') do RSpotify::Album.new_releases(limit: 10, offset: 10) end expect(albums.size) .to eq 10 expect(albums.map(&:name)) .to include('Recess', 'Atlas', 'Magic') - albums = VCR.use_cassette('album:new_releases:country:ES') do + albums = VCR.use_cassette('album:new_releases:country:ES') do RSpotify::Album.new_releases(country: 'ES') end expect(albums.size) .to eq 20 expect(albums.map(&:name)) .to include('Me Olvide de Vivir', 'Amor Futuro') end end describe 'Album::search' do it 'should search for the right albums' do - albums = VCR.use_cassette('album:search:AM') do + albums = VCR.use_cassette('album:search:AM') do RSpotify::Album.search('AM') end expect(albums) .to be_an Array expect(albums.size) .to eq 20 expect(albums.total) .to eq 8672 expect(albums.first) .to be_an RSpotify::Album expect(albums.map(&:name)) .to include('AM', 'Am I Wrong', 'A.M.', 'Melody AM') end it 'should accept additional options' do - albums = VCR.use_cassette('album:search:AM:limit:10') do + albums = VCR.use_cassette('album:search:AM:limit:10') do RSpotify::Album.search('AM', limit: 10) end expect(albums.size) .to eq 10 expect(albums.map(&:name)) .to include('AM', 'Am I Wrong') - albums = VCR.use_cassette('album:search:AM:offset:10') do + albums = VCR.use_cassette('album:search:AM:offset:10') do RSpotify::Album.search('AM', offset: 10) end expect(albums.size) .to eq 20 expect(albums.map(&:name)) .to include('Melody AM', 'I Am') - albums = VCR.use_cassette('album:search:AM:offset:10:limit:10') do + albums = VCR.use_cassette('album:search:AM:offset:10:limit:10') do RSpotify::Album.search('AM', limit: 10, offset: 10) end expect(albums.size) .to eq 10 expect(albums.map(&:name)) .to include('Melody AM')