1
0
mirror of https://github.com/danbee/mpd-client synced 2025-03-04 08:39:09 +00:00

Update artist spec.

This commit is contained in:
Dan Barber 2013-09-03 08:15:46 +01:00
parent 8d75b39e95
commit 9258b2749e
2 changed files with 7 additions and 4 deletions

View File

@ -7,10 +7,6 @@ class Artist
@name = name
end
def <=>(artist)
name <=> artist.name
end
def self.all
MPDConnection.mpd.artists.sort.map { |artist| Artist.new(artist) }
end

View File

@ -3,9 +3,16 @@ require 'spec_helper'
describe Artist do
let(:artist) { Artist.new('Alice Cooper') }
let(:artists) { ['Alice Cooper', 'Jimmy Eat World', 'Dream Theater'] }
it 'has attributes' do
expect(artist.name).to eq('Alice Cooper')
end
it 'returns all artists' do
MPDConnection.mpd.stub(:artists).and_return(artists)
expect(Artist.all).to have(3).items
expect(Artist.all.map(&:name)).to eq(artists.sort)
end
end