Sha256: 4993e5c272d33de49e6237e6d8a7e6bb1e1c6734193004475e687a1547d54082

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

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

describe '#library' do
  before { init_lastfm }

  it 'should return an instance of Lastfm::Library' do
    expect(@lastfm.library).to be_an_instance_of(Lastfm::MethodCategory::Library)
  end

  describe '#get_tracks' do
    it 'should get the tracks\' info' do
      expect(@lastfm).to receive(:request).with('library.getTracks', {
        :user => 'test',
        :artist => 'foo',
        :album => 'bar',
        :limit => nil,
        :page => nil
      }).and_return(make_response('library_get_tracks'))
      tracks = @lastfm.library.get_tracks(:user => 'test', :artist => 'foo', :album => 'bar')
      expect(tracks[0]['name']).to eq('Learning to Live')
      expect(tracks.size).to eq(1)
    end
  end

  describe '#get_artists' do
    it 'should get the artists\' info' do
      expect(@lastfm).to receive(:request).with('library.getArtists', {
        :user => 'test',
        :limit => nil,
        :page => nil
      }).and_return(make_response('library_get_artists'))
      artists = @lastfm.library.get_artists(:user => 'test')
      expect(artists[1]['name']).to eq('Dark Castle')
      expect(artists.size).to eq(2)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lastfm-1.27.4 spec/method_specs/library_spec.rb