Sha256: 882be40edf7a594d379d3192d3c7aaf6230302d2945eb62aa6363e60ff1d816e

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '../../spec_helper')

describe Tagooru::Playlist do
  it "requires contents when instantiated" do
    lambda {
      Tagooru::Playlist.new('hi')
    }.should_not raise_error
  end

  describe "parsing" do
    before do
      @playlist = Tagooru::Playlist.new fixture("fix.m3u")
    end

    it "scans playlist lines" do
      @playlist.should_receive(:lines).and_return([])
      @playlist.parse
    end

    it "includes track names and track locations" do
      track = @playlist.parse.first
      track.name.should == "Necro - You Did It"
      track.location.should == 'http://files.raplife.ru/jka/xxx/17--you_did_it-ftd.mp3'
    end

    it "understands track names with commas in them" do
      track = @playlist.parse.last
      track.name.should == "Jesus - I Fix my Eyes, on, You"
    end

    describe "#lines" do
      before do
        @playlist = Tagooru::Playlist.new "INFO\r\nline1\r\nline2\r\n"
      end

      it "skips the first line" do
        @playlist.send(:lines)[0].should_not =~ /INFO/
      end

      it "removes line separators" do
        @playlist.send(:lines).first.should_not =~ /(\r|\n)$/
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sandro-tagooru-0.1.1 spec/tagooru/playlist_spec.rb