Sha256: b9de0330580994800b53ee1b963fe467cd5cbe5a6c97857d473c7059f8e4c29c

Contents?: true

Size: 1.1 KB

Versions: 22

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe Kagu::Playlists do

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

  describe '#each' do

    it 'playlists must contains at least 1 song and a name' do
      expect(playlists.count).to be > 5
      playlists.each do |playlist|
        expect(playlist.name).not_to eq('Bibliothèque')
        expect(playlist.name).not_to match(/\&#\d+;/)
        expect(playlist.name).to be_a(String)
        expect(playlist.name).to be_present
        expect(playlist.tracks.size).to be > 0
      end
    end

    it 'does not fails if block is not given' do
      expect {
        expect(playlists.each).to be_nil
      }.not_to raise_error
    end

    it 'returns nil' do
      expect(playlists.each {}).to be_nil
    end

  end

  describe '#library' do

    it 'is library given at initialization' do
      expect(playlists.library).to be(library)
    end

    it 'raise an error if library is nil' do
      expect {
        Kagu::Playlists.new(nil)
      }.to raise_error(ArgumentError, 'Kagu::Playlists#library must be a library, nil given')
    end

  end

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
kagu-1.2.0 spec/kagu/playlists_spec.rb
kagu-1.1.2 spec/kagu/playlists_spec.rb
kagu-1.1.1 spec/kagu/playlists_spec.rb
kagu-1.1.0 spec/kagu/playlists_spec.rb
kagu-1.0.0 spec/kagu/playlists_spec.rb
kagu-0.4.7 spec/kagu/playlists_spec.rb
kagu-0.4.6 spec/kagu/playlists_spec.rb
kagu-0.4.5 spec/kagu/playlists_spec.rb
kagu-0.4.4 spec/kagu/playlists_spec.rb
kagu-0.4.3 spec/kagu/playlists_spec.rb
kagu-0.4.2 spec/kagu/playlists_spec.rb
kagu-0.4.1 spec/kagu/playlists_spec.rb
kagu-0.4.0 spec/kagu/playlists_spec.rb
kagu-0.3.3 spec/kagu/playlists_spec.rb
kagu-0.3.2 spec/kagu/playlists_spec.rb
kagu-0.3.1 spec/kagu/playlists_spec.rb
kagu-0.3.0 spec/kagu/playlists_spec.rb
kagu-0.2.4 spec/kagu/playlists_spec.rb
kagu-0.2.3 spec/kagu/playlists_spec.rb
kagu-0.2.2 spec/kagu/playlists_spec.rb