spec/method_specs/user_spec.rb in lastfm-1.17.0 vs spec/method_specs/user_spec.rb in lastfm-1.18.0
- old
+ new
@@ -6,15 +6,25 @@
it 'should return an instance of Lastfm::User' do
@lastfm.user.should be_an_instance_of(Lastfm::MethodCategory::User)
end
describe '#get_info' do
- it 'should get user info' do
- @lastfm.should_receive(:request).with('user.getInfo', {:user => 'test'}).and_return(make_response('user_get_info'))
- info = @lastfm.user.get_info(:user => 'test')
- info['id'].should == '1000002'
+ context 'with params' do
+ it 'should get user info' do
+ @lastfm.should_receive(:request).with('user.getInfo', {:user => 'test'}).and_return(make_response('user_get_info'))
+ info = @lastfm.user.get_info(:user => 'test')
+ info['id'].should == '1000002'
+ end
end
+
+ context 'without params' do
+ it 'should get current user info' do
+ @lastfm.should_receive(:request).with('user.getInfo', {}, :get, true, true).and_return(make_response('user_get_info'))
+ info = @lastfm.user.get_info
+ info['id'].should == '1000002'
+ end
+ end
end
describe '#get_top_artists' do
it 'should get user\'s top artists' do
@lastfm.should_receive(:request).with('user.getTopArtists', {
@@ -208,10 +218,10 @@
}).and_return(make_response('user_get_recent_tracks'))
tracks = @lastfm.user.get_recent_tracks(:user => 'test')
tracks[1]['artist']['content'].should == 'Kylie Minogue'
tracks.size.should == 2
end
-
+
it 'should not error when a user\'s recent tracks includes malformed data' do
@lastfm.should_receive(:request).with('user.getRecentTracks', {
:user => 'test',
:page => nil,
:limit => nil,