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
|
@name = name
|
||||||
end
|
end
|
||||||
|
|
||||||
def <=>(artist)
|
|
||||||
name <=> artist.name
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.all
|
def self.all
|
||||||
MPDConnection.mpd.artists.sort.map { |artist| Artist.new(artist) }
|
MPDConnection.mpd.artists.sort.map { |artist| Artist.new(artist) }
|
||||||
end
|
end
|
||||||
|
|||||||
@ -3,9 +3,16 @@ require 'spec_helper'
|
|||||||
describe Artist do
|
describe Artist do
|
||||||
|
|
||||||
let(:artist) { Artist.new('Alice Cooper') }
|
let(:artist) { Artist.new('Alice Cooper') }
|
||||||
|
let(:artists) { ['Alice Cooper', 'Jimmy Eat World', 'Dream Theater'] }
|
||||||
|
|
||||||
it 'has attributes' do
|
it 'has attributes' do
|
||||||
expect(artist.name).to eq('Alice Cooper')
|
expect(artist.name).to eq('Alice Cooper')
|
||||||
end
|
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
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user