spec/hallon/artist_spec.rb in hallon-0.13.0 vs spec/hallon/artist_spec.rb in hallon-0.14.0

- old
+ new

@@ -1,7 +1,9 @@ # coding: utf-8 describe Hallon::Artist do + it { should be_a Hallon::Loadable } + it_should_behave_like "a Linkable object" do let(:spotify_uri) { "spotify:artist:3bftcFwl4vqRNNORRsqm1G" } end let(:artist) { Hallon::Artist.new(mock_artist) } @@ -27,22 +29,26 @@ end describe "#portrait" do let(:link) { Hallon::Link.new(mock_image_uri) } - specify "as an image" do - mock_session(2) { artist.portrait.should eq Hallon::Image.new(mock_image_id) } + it "should be nil if an image is not available" do + Spotify.should_receive(:artist_portrait).and_return(null_pointer) + artist.portrait.should be_nil end - specify "as a link" do - artist.portrait(false).should eq Hallon::Link.new(mock_image_uri) + it "should be an image if it exists" do + stub_session { artist.portrait.should eq Hallon::Image.new(mock_image_id) } end + end + describe "#portrait_link" do it "should be nil if an image is not available" do - Spotify.should_receive(:artist_portrait).and_return(null_pointer) - artist.portrait.should be_nil - Spotify.should_receive(:link_create_from_artist_portrait).and_return(null_pointer) - artist.portrait(false).should be_nil + artist.portrait_link.should be_nil + end + + it "should be a link if it exists" do + artist.portrait_link.should eq Hallon::Link.new(mock_image_uri) end end end