Sha256: 76bae1f779c9aa8eede2329e5daf050b6ed2520a62637386abead3514c1005d8

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe Picky::Indexers::Base do

  let(:some_index_or_category) { stub :some_index_or_category, :name => 'some index or category' }
  let(:indexer) { described_class.new some_index_or_category }

  describe 'index_or_category' do
    it 'returns the right thing' do
      indexer.index_or_category.should == some_index_or_category
    end
  end

  describe 'source' do
    it 'delegates it to the index or category' do
      some_index_or_category.should_receive(:source).once.with

      indexer.source
    end
  end

  describe 'index' do
    it 'processes' do
      categories = stub :categories, :empty => nil, :cache => nil

      indexer.should_receive(:process).once.with categories

      indexer.index categories
    end
    it 'calls the right methods on the categories' do
      indexer.stub! :process

      categories = stub :categories

      categories.should_receive(:empty).once.ordered
      categories.should_receive(:cache).once.ordered

      indexer.index categories
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
picky-3.6.7 spec/lib/indexers/base_spec.rb
picky-3.6.6 spec/lib/indexers/base_spec.rb
picky-3.6.4 spec/lib/indexers/base_spec.rb
picky-3.6.3 spec/lib/indexers/base_spec.rb
picky-3.6.2 spec/lib/indexers/base_spec.rb
picky-3.6.1 spec/lib/indexers/base_spec.rb
picky-3.6.0 spec/lib/indexers/base_spec.rb
picky-3.5.4 spec/lib/indexers/base_spec.rb