spec/lastfm_spec.rb in lastfm-0.4.0 vs spec/lastfm_spec.rb in lastfm-0.5.0

- old
+ new

@@ -343,12 +343,40 @@ events[0]['tickets']['ticket']['content'].should eql("http://www.last.fm/affiliate/byid/29/1584537/12/ws.artist.events.b25b959554ed76058ac220b7b2e0a026") events[0]['tags']['tag'].should == ["pop", "dance", "female vocalists", "80s", "cher"] end end + describe '#geo' do + it 'should return an instance of Lastfm::Geo' do + @lastfm.geo.should be_an_instance_of(Lastfm::MethodCategory::Geo) + end + + it 'should get events' do + @lastfm.should_receive(:request).with('geo.getEvents', { + :location => 'Boulder', + :distance => nil, + :limit => nil, + :page => nil + }).and_return(make_response('geo_get_events')) + + events = @lastfm.geo.get_events('Boulder') + events.size.should eql(1) + events[0]['title'].should eql('Transistor Festival') + events[0]['artists'].size.should == 2 + events[0]['artists']['headliner'].should eql('Not Breathing') + events[0]['venue']['name'].should eql('The Walnut Room') + events[0]['venue']['location']['city'].should eql('Denver, CO') + events[0]['venue']['location']['point']['lat'].should eql("39.764316") + events[0]['image'].size.should eql(4) + events[0]['image'][0]['size'].should eql('small') + events[0]['image'][0]['content'].should eql('http://userserve-ak.last.fm/serve/34/166214.jpg') + events[0]['startDate'].should eql("Fri, 10 Jun 2011 01:58:01") + end + end + describe '#user' do - it 'should return and instance of Lastfm::User' do + 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 @@ -396,9 +424,28 @@ :from => nil }).and_return(make_response('user_get_recent_tracks')) tracks = @lastfm.user.get_recent_tracks('test') tracks[1]['artist']['content'].should eql('Kylie Minogue') tracks.size.should == 2 + end + end + end + + describe '#library' do + it 'should return an instance of Lastfm::Library' do + @lastfm.library.should be_an_instance_of(Lastfm::MethodCategory::Library) + end + + describe '#get_artists' do + it 'should get the artists\' info' do + @lastfm.should_receive(:request).with('library.getArtists', { + :user => 'test', + :limit => nil, + :page => nil + }).and_return(make_response('library_get_artists')) + artists = @lastfm.library.get_artists('test') + artists[1]['name'].should eql('Dark Castle') + artists.size.should == 2 end end end end