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:
parent
8d75b39e95
commit
9258b2749e
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user