Sha256: eac203e24337e735e5651d59519cb8d8bee72e91073b0f10d5e6f463e6008f7e

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

#!/usr/bin/env jruby -S spec
require File.join(File.dirname(__FILE__), 'spec_helper')
require 'jotify'

describe Jotify do  
  
  before(:each) do
    @jotify_impl = mock('JotifyImpl')
    @jotify_impl.stub!(:login)
    @jotify = Jotify.new(@jotify_impl)
  end  
  
  it "should resolve ids" do    
    { "spotify:user:flumix:playlist:2mnbxTkghYtlHMdX3jdP9C" => "4d921ebcdd8c80f32ce1ed5acafbb9c8",
      "http://open.spotify.com/user/flumix/playlist/2mnbxTkghYtlHMdX3jdP9C" => "4d921ebcdd8c80f32ce1ed5acafbb9c8",
      "2mnbxTkghYtlHMdX3jdP9C" => "4d921ebcdd8c80f32ce1ed5acafbb9c8",
      "4d921ebcdd8c80f32ce1ed5acafbb9c8" => "4d921ebcdd8c80f32ce1ed5acafbb9c8"
    }.each { |id, expected| Jotify.resolve_id(id).should == expected }
  end
  
  it "should add tracks to playlist" do    
    @playlist = Jotify::Media::Playlist.new
    @jotify_impl.should_receive(:playlistAddTracks) do |playlist, tracks, pos|
      playlist.should be_a(Jotify::Media::Playlist)
      #playlist.should == @playlist
      pos.should == 0
      tracks.should be_an(Java::JavaUtil::List)
      tracks.size.should == 1
    end
    @jotify.add_tracks_to_playlist(@playlist, ['4d921ebcdd8c80f32ce1ed5acafbb9c8'])
  end    
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jberkel-spotify-api-0.0.1 spec/jotify_spec.rb
jberkel-spotify-api-0.0.2 spec/jotify_spec.rb
jberkel-spotify-api-0.0.3 spec/jotify_spec.rb