spec/lib/rspotify/user_spec.rb in rspotify-1.2.0 vs spec/lib/rspotify/user_spec.rb in rspotify-1.3.0
- old
+ new
@@ -2,11 +2,13 @@
describe 'User::find' do
before(:each) do
# Get wizzler user as a testing sample
- @user = RSpotify::User.find('wizzler')
+ @user = VCR.use_cassette('user:find:wizzler') do
+ RSpotify::User.find('wizzler')
+ end
end
it 'should find user with correct attributes' do
expect(@user.external_urls['spotify']) .to eq 'https://open.spotify.com/user/wizzler'
expect(@user.href) .to eq 'https://api.spotify.com/v1/users/wizzler'
@@ -17,15 +19,20 @@
it 'should find user with correct playlists' do
# Keys generated specifically for the tests. Should be removed in the future
client_id = '5ac1cda2ad354aeaa1ad2693d33bb98c'
client_secret = '155fc038a85840679b55a1822ef36b9b'
- RSpotify.authenticate(client_id, client_secret)
+ VCR.use_cassette('authenticate:5ac1cda2ad354aeaa1ad2693d33bb98c') do
+ RSpotify.authenticate(client_id, client_secret)
+ end
- playlists = @user.playlists
+
+ playlists = VCR.use_cassette('user:wizzler:playlists') do
+ @user.playlists
+ end
expect(playlists) .to be_an Array
- expect(playlists.size) .to eq 7
+ expect(playlists.size) .to eq 6
expect(playlists.first) .to be_an RSpotify::Playlist
- expect(playlists.map(&:name)) .to include('Movie Soundtrack Masterpieces', 'Blue Mountain State', 'Starred')
+ expect(playlists.map(&:name)) .to include('Movie Soundtrack Masterpieces', 'Blue Mountain State', 'Video Game Masterpieces')
end
end
end