Sha256: ca90e2c2f6d67a2d4015315044002fd1695a6690880ed9ce86288a696c3f0026

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

require 'spotify_to_mp3/spotify'

module SpotifyToMp3
  describe Spotify do
    before(:each) do
      @spotify = SpotifyToMp3::Spotify.new
    end

    context '#get_track' do
      it "resolves HTTP URLs" do
        track = @spotify.get_track('http://open.spotify.com/track/0qgiFuYhYuwtFXEwYakddE')
        track.name.should == "I Will Survive"
        track.artist.should == "Cake"
      end

      it "resolves Spotify URIs" do
        track = @spotify.get_track('spotify:track:0qgiFuYhYuwtFXEwYakddE')
        track.name.should == "I Will Survive"
        track.artist.should == "Cake"
      end

      it "fails on nonexistent URI" do
        expect { @spotify.get_track('spotify:track:not-found') }.to raise_error
      end
    end

    context "#resolvable_uri?" do
      it "accepts HTTP URLs" do
        @spotify.resolvable_uri?('http://open.spotify.com/track/0qgiFuYhYuwtFXEwYakddE').should be_true
      end

      it "accepts Spotify URIs" do
        @spotify.resolvable_uri?('spotify:track:0qgiFuYhYuwtFXEwYakddE').should be_true
      end

      it "refuses other URIs" do
        @spotify.resolvable_uri?('123').should be_false
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spotify-to-mp3-0.6.1 spec/spotify_spec.rb
spotify-to-mp3-0.6.0 spec/spotify_spec.rb