Sha256: 9d02c46954ab6542f912cd7d919ee8fa38926956b3dea6b67004f51a4584f406

Contents?: true

Size: 1.45 KB

Versions: 9

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

describe Index::Type do
  
  context "with categories" do
    before(:each) do
      @some_type1 = stub :some_type1, :name => :some_type1
      @some_type2 = stub :some_type2, :name => :some_type2
      
      @category1 = Index::Category.new :some_category_name1, @some_type1
      @category2 = Index::Category.new :some_category_name2, @some_type2
      
      @index = Index::Type.new :some_name, :some_result_type, false, @category1, @category2
    end
    describe "generate_caches" do
      it "delegates to each category" do
        @category1.should_receive(:generate_caches).once.with
        @category2.should_receive(:generate_caches).once.with
        
        @index.generate_caches
      end
    end
    describe "load_from_cache" do
      it "delegates to each category" do
        @category1.should_receive(:load_from_cache).once.with
        @category2.should_receive(:load_from_cache).once.with
        
        @index.load_from_cache
      end
    end
  end
  
  context "no categories" do
    before(:each) do
      @combinator = stub :combinator
      Query::Combinator.stub! :new => @combinator
      
      @index = Index::Type.new :some_name, :some_result_type, false
    end
    
    describe "possible_combinations" do
      it "delegates to the combinator" do
        @combinator.should_receive(:possible_combinations_for).once.with :some_token
        
        @index.possible_combinations :some_token
      end
    end
  end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
picky-0.10.5 spec/lib/index/type_spec.rb
picky-0.10.4 spec/lib/index/type_spec.rb
picky-0.10.2 spec/lib/index/type_spec.rb
picky-0.10.1 spec/lib/index/type_spec.rb
picky-0.10.0 spec/lib/index/type_spec.rb
picky-0.9.4 spec/lib/index/type_spec.rb
picky-0.9.3 spec/lib/index/type_spec.rb
picky-0.9.2 spec/lib/index/type_spec.rb
picky-0.9.1 spec/lib/index/type_spec.rb