Sha256: b9cd4b90d871fd24b6b7171c213cb92a3a8cf25f5920df6f0a8c435bffeae9d5

Contents?: true

Size: 1.4 KB

Versions: 35

Compression:

Stored size: 1.4 KB

Contents

# encoding: utf-8
#
require 'spec_helper'

describe Picky::Indexes do

  context 'after initialize' do
    let(:indexes) { described_class.new }
    it 'has no indexes' do
      indexes.indexes.should == []
    end
  end

  describe 'methods' do
    let(:indexes) { described_class.new }
    before(:each) do
      @index1 = stub :index1, :name => :index1
      @index2 = stub :index2, :name => :index2
      indexes.register @index1
      indexes.register @index2
    end
    describe 'index_for_tests' do
      it 'takes a snapshot, then indexes and caches each' do
        @index1.should_receive(:index).once.with.ordered
        @index2.should_receive(:index).once.with.ordered
      
        indexes.index_for_tests
      end
    end
    describe 'register' do
      it 'should have indexes' do
        indexes.indexes.should == [@index1, @index2]
      end
    end
    describe 'clear_indexes' do
      it 'clears the indexes' do
        indexes.clear_indexes
      
        indexes.indexes.should == []
      end
    end
    def self.it_delegates_each name
      describe name do
        it "calls #{name} on each in order" do
          @index1.should_receive(name).once.with.ordered
          @index2.should_receive(name).once.with.ordered

          indexes.send name
        end
      end
    end
    it_delegates_each :check
    it_delegates_each :clear
    it_delegates_each :backup
    it_delegates_each :restore
  end
  
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
picky-3.5.4 spec/lib/indexes_indexing_spec.rb
picky-3.5.3 spec/lib/indexes_indexing_spec.rb
picky-3.5.2 spec/lib/indexes_indexing_spec.rb
picky-3.5.1 spec/lib/indexes_indexing_spec.rb
picky-3.5.0 spec/lib/indexes_indexing_spec.rb
picky-3.4.3 spec/lib/indexes_indexing_spec.rb
picky-3.4.2 spec/lib/indexes_indexing_spec.rb
picky-3.4.1 spec/lib/indexes_indexing_spec.rb
picky-3.4.0 spec/lib/indexes_indexing_spec.rb
picky-3.3.3 spec/lib/indexes_indexing_spec.rb
picky-3.3.2 spec/lib/indexes_indexing_spec.rb
picky-3.3.1 spec/lib/indexes_indexing_spec.rb
picky-3.3.0 spec/lib/indexes_indexing_spec.rb
picky-3.2.0 spec/lib/indexes_indexing_spec.rb
picky-3.1.13 spec/lib/indexes_indexing_spec.rb
picky-3.1.12 spec/lib/indexes_indexing_spec.rb
picky-3.1.11 spec/lib/indexes_indexing_spec.rb
picky-3.1.10 spec/lib/indexes_indexing_spec.rb
picky-3.1.9 spec/lib/indexes_indexing_spec.rb
picky-3.1.8 spec/lib/indexes_indexing_spec.rb