From 9258b2749e9383cafa9c3515ed39cffcba7e20e8 Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Tue, 3 Sep 2013 08:15:46 +0100 Subject: [PATCH] Update artist spec. --- models/artist.rb | 4 ---- spec/models/artist_spec.rb | 7 +++++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/models/artist.rb b/models/artist.rb index db1e556..dcf564e 100644 --- a/models/artist.rb +++ b/models/artist.rb @@ -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 diff --git a/spec/models/artist_spec.rb b/spec/models/artist_spec.rb index 655e610..ac7559c 100644 --- a/spec/models/artist_spec.rb +++ b/spec/models/artist_spec.rb @@ -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