Sha256: 86ed23b42f427def3a81065cb3d396d46dc7e1a5046715c260d1030131b16605

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

module RapGenius
  describe Artist do
    context "given Drake", vcr: { cassette_name: "artist-130" } do
      subject(:artist) { described_class.find(130) }

      its(:url) { should eq "http://rapgenius.com/artists/Drake" }
      its(:name) { should eq "Drake" }
      its(:image) { should eq "http://images.rapgenius.com/2b3fa8326a5277fa31f2012a7b581e2e.500x319x11.gif" }
      its(:description) { should include "Drake is part of a generation of new rappers" }

      context "#songs" do
        subject { artist.songs }

        # The iOS app only loads a certain number, and doesn't (appear to)
        # support pagination
        its(:count) { should eq 25}

        its(:last) { should be_a Song }
        its("last.title") { should eq "Bitch Is Crazy" }
      end

      context "a non-existent artist ID" do
        subject(:artist) { described_class.find("bahahaha") }

        it "raises an exception" do
          expect { artist }.to raise_exception
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rapgenius-1.0.0 spec/rapgenius/artist_spec.rb