Sha256: 956cc5bfcf8c83d74a09471d77bab6b1ac13ad2ac487e16fd22b26879af12244

Contents?: true

Size: 1.24 KB

Versions: 13

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

describe Kagu::Library do

  let(:library) { Kagu::Library.new }

  describe '#initialize' do

    it 'is correct by default' do
      expect(library.path).to eq("#{ENV['HOME']}/Music/iTunes/iTunes Music Library.xml")
    end

    it 'raise an error if directory' do
      expect {
        Kagu::Library.new('/tmp')
      }.to raise_error(Kagu::Error, 'No such file: "/tmp"')
    end

    it "raise an error if file can't be found" do
      expect {
        Kagu::Library.new('/tmp/bar.foo.baz')
      }.to raise_error(Kagu::Error, 'No such file: "/tmp/bar.foo.baz"')
    end

  end

  describe '#finder' do

    it 'returns a Kagu::Finder instance' do
      expect(library.finder).to be_a(Kagu::Finder)
    end

    it 'options can be specified' do
      expect(library.finder(replacements: { 'foo' => 'bar' }).replacements).to eq([{ 'foo' => 'bar' }])
    end

  end

  describe '#playlists' do

    it 'returns a Playlists object' do
      expect(library.playlists).to be_a(Kagu::Playlists)
      expect(library.playlists.library).to be(library)
    end

  end

  describe '#tracks' do

    it 'returns a Tracks object' do
      expect(library.tracks).to be_a(Kagu::Tracks)
      expect(library.tracks.library).to be(library)
    end

  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
kagu-1.2.0 spec/kagu/library_spec.rb
kagu-1.1.2 spec/kagu/library_spec.rb
kagu-1.1.1 spec/kagu/library_spec.rb
kagu-1.1.0 spec/kagu/library_spec.rb
kagu-1.0.0 spec/kagu/library_spec.rb
kagu-0.4.7 spec/kagu/library_spec.rb
kagu-0.4.6 spec/kagu/library_spec.rb
kagu-0.4.5 spec/kagu/library_spec.rb
kagu-0.4.4 spec/kagu/library_spec.rb
kagu-0.4.3 spec/kagu/library_spec.rb
kagu-0.4.2 spec/kagu/library_spec.rb
kagu-0.4.1 spec/kagu/library_spec.rb
kagu-0.4.0 spec/kagu/library_spec.rb