Sha256: bcf842e2142ec40854e4f3a3a123ca5cbc3c95a72f2893984fd1fbd8e377841f

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 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://genius.com/artists/Drake" }
      its(:name) { should eq "Drake" }
      its(:image) { should eq "http://images.rapgenius.com/6e996fe91d484c626f1b36686cb27d7c.450x253x70.gif" }
      its(:description) { should include "Drake is part of a generation of new rappers" }

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

        its(:count) { should eq 20 }
        its(:last) { should be_a Song }
        its("last.title") { should eq "Amen" }

        context "pagination" do
          subject { artist.songs(page: 3) }

          its(:last) { should be_a Song }
          its(:count) { should eq 20 }
          its("last.title") { should eq "Champion" }
        end
      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

2 entries across 2 versions & 1 rubygems

Version Path
rapgenius-1.1.0 spec/rapgenius/artist_spec.rb
rapgenius-1.0.5 spec/rapgenius/artist_spec.rb