Sha256: 352a78d11d2e5cab48f6a57acf9b3f32264103194abb84d0ff2ab97642ee488f

Contents?: true

Size: 1.25 KB

Versions: 30

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe Picky::Indexes do

  let(:index) { double :some_index,   :name => :some_index }
  let(:index2) { double :some_index2, :name => :some_index }

  context 'with instance' do
    let(:indexes) { Picky::Indexes.new }

    describe 'indexes' do
      it 'exists' do
        lambda { indexes.indexes }.should_not raise_error
      end
      it 'is empty by default' do
        indexes.indexes.should be_empty
      end
    end
  end

  context 'with singleton' do
    let(:indexes) { Picky::Indexes.instance }

    describe 'indexes' do
      it 'exists' do
        lambda { indexes.indexes }.should_not raise_error
      end
    end

    describe 'clear_indexes' do
      it 'clears the indexes' do
        indexes.register index

        indexes.clear_indexes

        indexes.indexes.should == []
      end
    end

    describe 'register' do
      it 'adds the given index to the indexes' do
        indexes.clear_indexes

        indexes.register index

        indexes.indexes.should == [index]
      end
      # it 'does remove duplicates (with same name)' do
      #   indexes.clear_indexes
      # 
      #   indexes.register index
      #   indexes.register index2
      # 
      #   indexes.indexes.should == [index2]
      # end
    end
  end

end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
picky-4.31.3 spec/lib/indexes_spec.rb
picky-4.31.2 spec/lib/indexes_spec.rb
picky-4.31.1 spec/lib/indexes_spec.rb
picky-4.31.0 spec/lib/indexes_spec.rb
picky-4.30.0 spec/lib/indexes_spec.rb
picky-4.29.0 spec/lib/indexes_spec.rb
picky-4.28.1 spec/lib/indexes_spec.rb
picky-4.27.1 spec/lib/indexes_spec.rb
picky-4.27.0 spec/lib/indexes_spec.rb
picky-4.26.2 spec/lib/indexes_spec.rb
picky-4.26.1 spec/lib/indexes_spec.rb
picky-4.26.0 spec/lib/indexes_spec.rb
picky-4.25.3 spec/lib/indexes_spec.rb
picky-4.25.2 spec/lib/indexes_spec.rb
picky-4.25.1 spec/lib/indexes_spec.rb
picky-4.25.0 spec/lib/indexes_spec.rb
picky-4.24.0 spec/lib/indexes_spec.rb
picky-4.23.2 spec/lib/indexes_spec.rb
picky-4.23.1 spec/lib/indexes_spec.rb
picky-4.23.0 spec/lib/indexes_spec.rb