Sha256: df906d7c7b4ef14e5cbd0567498b6a1b89143b820737d3d93fe1876aae41d0eb

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

describe RSpotify::User do

  describe 'User#find' do

    before(:each) do
      # Get wizzler user as a testing sample
      @user = RSpotify::User.find('wizzler')
    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'
      expect(@user.id)                       .to eq 'wizzler'
      expect(@user.type)                     .to eq 'user'
      expect(@user.uri)                      .to eq 'spotify:user:wizzler'
    end

    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)

      playlists = @user.playlists
      expect(playlists)             .to be_an Array
      expect(playlists.size)        .to eq 7
      expect(playlists.first)       .to be_an RSpotify::Playlist
      expect(playlists.map(&:name)) .to include('Movie Soundtrack Masterpieces', 'Blue Mountain State', 'Starred')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rspotify-0.5.0 spec/lib/rspotify/user_spec.rb
rspotify-0.4.0 spec/lib/rspotify/user_spec.rb
rspotify-0.3.1 spec/lib/rspotify/user_spec.rb