Sha256: ae0b95e83b9070754fb9c5dbb946f3b78b70471b4069b429cfd422b8951a45fd

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe 'Soundcloud::Models::Playlist' do
   before(:all) do
    @sc = Soundcloud.register({:access_token=> valid_oauth_access_token, :site => soundcloud_site})
    @api_test_1 = @sc.User.find('api-test-1')   
    @api_test_2 = @sc.User.find('api-test-2')   
    @api_test_3 = @sc.User.find('api-test-3')
    
  end  
  
  it 'should be able to create and deleta a new playlist' do
    # TODO is not implemented in the soundcloud api
    #    pl = @sc.Playlist.new
    #   pl.title = 'Static Test Playlist'
    #     pl.tracks << @sc.Track.find('static-test-track')    
    
    #   p pl.to_xml
    #   pl.save
  end
  
  it 'should be able to find an existing playlist' do 
    pl = @sc.Playlist.find('static-test-playlist')
    pl.tracks.length.should be >= 3    
  end
  
  it 'should be able to delete tracks of a playlist and put them back' do 
    pl = @sc.Playlist.find('my-static-playlist')    
    old_count = pl.tracks.length
    deleted_track = pl.tracks.first
    pl.tracks.delete_at 0
    pl.save
    pl.tracks.length.should be == old_count -1
    
    pl.tracks << deleted_track
    pl.save
    pl.tracks.length.should be == old_count
  end
  
  it 'should belong to a user' do
    pl = @sc.Playlist.find('static-test-playlist')
    # check against online attribute, to make sure the complete user is loaded, not the nested user 
    pl.user.online.should_not be nil
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
soundcloud-ruby-api-wrapper-0.3.1 spec/soundcloud_playlist_spec.rb
soundcloud-ruby-api-wrapper-0.3.2 spec/soundcloud_playlist_spec.rb
soundcloud-ruby-api-wrapper-0.3.3 spec/soundcloud_playlist_spec.rb