Sha256: 9799cbea22b7fbcc5ac258b3b704593b40cc534c00797bc4c87264b3d8dfd503

Contents?: true

Size: 1.56 KB

Versions: 30

Compression:

Stored size: 1.56 KB

Contents

require 'spec_helper'

describe Picky::Index do

  context 'without stubbed categories' do
    before(:each) do
      @index = described_class.new :some_index_name
    end

    describe 'category' do
      it 'adds a new category to the categories' do
        @index.category :some_category_name

        @index.categories.categories.size.should == 1
      end
      it 'returns the new category' do
        @index.category(:some_category_name).should be_kind_of(Picky::Category)
      end
    end
  end

  context "with stubbed categories" do
    before(:each) do
      @categories = double :categories

      @index = described_class.new :some_name
      @index.category :some_category_name1
      @index.category :some_category_name2

      @index.stub :categories => @categories
    end

    describe "load" do
      it "forwards to each category" do
        @categories.should_receive(:load).once.with no_args

        @index.load
      end
    end
  end

  context 'result_identifier' do
    context 'with it set' do
      let(:index) do
        described_class.new :some_name do
          result_identifier :some_identifier
        end
      end
      it 'has an after_indexing set' do
        index.result_identifier.should == :some_identifier
      end
    end
    context 'with it not set' do
      let(:index) do
        described_class.new :some_name do
        end
      end
      it 'returns the name' do
        index.result_identifier.should == :some_name
      end
    end
  end

  context "no categories" do
    it "works" do
      described_class.new :some_name
    end
  end

end

Version data entries

30 entries across 30 versions & 1 rubygems

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