Sha256: acb53333f60f758f76a05d618b9148a4d81a55c702d9794d2ebbf5978a46153e

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

require 'helper'

class PlaylistsTests < Test::Unit::TestCase

  context "When using the official.fm API and working with Playlists" do
    setup do
      @client = officialfm_test_client
    end
    
    should "search for 5 playlists with the 'R&B Mixtape' search term" do
      stub_get('http://api.official.fm/search/playlists/R%26B+Mixtape?key=GNXbH3zYb25F1I7KVEEN&format=json&api_max_responses=5', 'playlists.json')
      tracks = @client.playlists('R&B Mixtape', :limit => 5)
      tracks.length.should == 5
      tracks[0].running_time.should == 4167
      tracks[3].tracks[1].should == 40057
    end
    
    should "get info on HLSTRS Timeless mixtape" do
      stub_get('http://api.official.fm/playlist/55569?key=GNXbH3zYb25F1I7KVEEN&format=json&api_embed_codes=', 'playlist.json')
      playlist = @client.playlist(55569)
      playlist.shuffle.should == false
      playlist.user_id.should == 46269
    end
    
    should "get playlist votes on HLSTRS Timeless mixtape" do
      stub_get('http://api.official.fm/playlist/55569/votes?key=GNXbH3zYb25F1I7KVEEN&format=json&api_max_responses=', 'playlist_votes.json')
      votes = @client.playlist_votes(55569)
      votes[0].name.should == 'VALERIAN'
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
officialfm-0.0.4 test/playlists_test.rb
officialfm-0.0.3 test/playlists_test.rb
officialfm-0.0.2 test/playlists_test.rb
officialfm-0.0.1 test/playlists_test.rb