Sha256: d3dda350528c8add0c06cbabced5b4c5e30e63ee09963eb97cc7944533d3bb32

Contents?: true

Size: 1.38 KB

Versions: 8

Compression:

Stored size: 1.38 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe '#tag' do
  before { init_lastfm }

  it 'should return an instance of Lastfm::Tag' do
    @lastfm.tag.should be_an_instance_of(Lastfm::MethodCategory::Tag)
  end

  describe '#get_top_artists' do
    it 'should get top artists of some tag' do
      @lastfm.should_receive(:request).with('tag.getTopArtists', {
        :tag => 'Disco',
        :limit => nil,
        :page => nil
      }).and_return(make_response('tag_get_top_artists'))

      artists = @lastfm.tag.get_top_artists(:tag => 'Disco')
      artists.size.should == 5
      artists[0]['name'].should == 'Bee Gees'
      artists[0]['url'].should == 'http://www.last.fm/music/Bee+Gees'
      artists[1]['name'].should == 'ABBA'
    end
  end

  describe '#get_top_tracks' do
    it 'should get top tracks of a given tag' do
      @lastfm.should_receive(:request).with('tag.getTopTracks', {
        :tag => 'Disco',
        :limit => 5,
        :page => nil
      }).and_return(make_response('tag_get_top_tracks'))

      tracks = @lastfm.tag.get_top_tracks(:tag => 'Disco', :limit => 5)
      tracks.size.should == 5
      tracks[0]['name'].should == 'Stayin\' Alive'
      tracks[0]['url'].should == 'http://www.last.fm/music/Bee+Gees/_/Stayin%27+Alive'
      tracks[0]['artist']['name'].should == 'Bee Gees'
      tracks[1]['name'].should == 'September'
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
lastfm-1.22.0 spec/method_specs/tag_spec.rb
lastfm-1.21.0 spec/method_specs/tag_spec.rb
lastfm-1.20.1 spec/method_specs/tag_spec.rb
lastfm-1.19.1 spec/method_specs/tag_spec.rb
lastfm-1.19.0 spec/method_specs/tag_spec.rb
lastfm-1.18.0 spec/method_specs/tag_spec.rb
lastfm-1.17.0 spec/method_specs/tag_spec.rb
lastfm-1.16.0 spec/method_specs/tag_spec.rb