Sha256: 28238be03c0d62253ef64b2dd998ecf74b6a34028b623a90be216b81a34e7d8f

Contents?: true

Size: 1.41 KB

Versions: 31

Compression:

Stored size: 1.41 KB

Contents

describe RSpotify::User do

  describe 'User::find' do

    before(:each) do
      # Get wizzler user as a testing sample
      @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.followers['total'])       .to be > 0
      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'
      authenticate_client

      playlists = VCR.use_cassette('user:wizzler:playlists:limit:20:offset:0') do
        @user.playlists
      end
      expect(playlists)             .to be_an Array
      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', 'Video Game Masterpieces')
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
rspotify-2.12.4 spec/lib/rspotify/user_spec.rb
rspotify-2.12.3 spec/lib/rspotify/user_spec.rb
rspotify-2.12.2 spec/lib/rspotify/user_spec.rb
rspotify-2.12.1 spec/lib/rspotify/user_spec.rb
rspotify-2.12.0 spec/lib/rspotify/user_spec.rb
rspotify-2.11.1 spec/lib/rspotify/user_spec.rb
rspotify-2.11.0 spec/lib/rspotify/user_spec.rb
rspotify-2.10.3 spec/lib/rspotify/user_spec.rb
rspotify-2.10.2 spec/lib/rspotify/user_spec.rb
rspotify-2.10.1 spec/lib/rspotify/user_spec.rb
rspotify-2.10.0 spec/lib/rspotify/user_spec.rb
rspotify-2.9.2 spec/lib/rspotify/user_spec.rb
rspotify-2.9.1 spec/lib/rspotify/user_spec.rb
rspotify-2.9.0 spec/lib/rspotify/user_spec.rb
rspotify-2.8.0 spec/lib/rspotify/user_spec.rb
rspotify-2.7.0 spec/lib/rspotify/user_spec.rb
rspotify-2.6.1 spec/lib/rspotify/user_spec.rb
rspotify-2.6.0 spec/lib/rspotify/user_spec.rb
rspotify-2.5.0 spec/lib/rspotify/user_spec.rb
rspotify-2.4.1 spec/lib/rspotify/user_spec.rb