spec/method_specs/user_spec.rb in lastfm-1.26.0 vs spec/method_specs/user_spec.rb in lastfm-1.27.0
- old
+ new
@@ -175,9 +175,39 @@
tracks[1]['rank'].should == nil
tracks[1]['name'].should == 'Working Titles'
tracks[1]['artist']['name'].should == 'Damien Jurado'
end
+
+ it 'should always return an array of tracks' do
+ @lastfm.should_receive(:request).with('user.getLovedTracks', {
+ :user => 'test',
+ :period => nil,
+ :limit => nil,
+ :page => nil
+ }).and_return(make_response('user_get_loved_tracks_single_track'))
+
+ tracks = @lastfm.user.get_loved_tracks(:user => 'test')
+
+ tracks.size.should == 1
+
+ tracks[0]['rank'].should == nil
+ tracks[0]['name'].should == 'I Spy'
+ tracks[0]['artist']['name'].should == 'Mikhael Paskalev'
+ end
+
+ it 'should return an empty array when user has 0 loved tracks' do
+ @lastfm.should_receive(:request).with('user.getLovedTracks', {
+ :user => 'test',
+ :period => nil,
+ :limit => nil,
+ :page => nil
+ }).and_return(make_response('user_get_loved_tracks_no_tracks'))
+
+ tracks = @lastfm.user.get_loved_tracks(:user => 'test')
+
+ tracks.size.should == 0
+ end
end
describe '#get_friends' do
it 'should get user\'s friends' do
@lastfm.should_receive(:request).with('user.getFriends', {