Sha256: 5e2b580e597f186232755279ceb64b3ad08b3f7611b28fd4343844d580d138a0

Contents?: true

Size: 1.4 KB

Versions: 24

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe Internals::Indexed::Index do
  
  context 'without stubbed categories' do
    before(:each) do
      @index = described_class.new :some_index_name
    end
    
    describe 'define_category' do
      it 'adds a new category to the categories' do
        @index.define_category :some_category_name
        
        @index.categories.categories.size.should == 1 
      end
      it 'returns the new category' do
        @index.define_category(:some_category_name).should be_kind_of(Internals::Indexed::Category)
      end
    end
  end
  
  context "with stubbed categories" do
    before(:each) do
      @categories = stub :categories
      
      @index = described_class.new :some_name
      @index.define_category :some_category_name1
      @index.define_category :some_category_name2
      
      @index.stub! :categories => @categories
    end
    
    describe "load_from_cache" do
      it "delegates to each category" do
        @categories.should_receive(:load_from_cache).once.with
        
        @index.load_from_cache
      end
    end
    describe "possible_combinations" do
      it "delegates to the combinator" do
        @categories.should_receive(:possible_combinations_for).once.with :some_token
        
        @index.possible_combinations :some_token
      end
    end
  end
  
  context "no categories" do
    it "works" do
      described_class.new :some_name
    end
  end
  
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
picky-1.5.1 spec/lib/internals/indexed/index_spec.rb
picky-1.5.0 spec/lib/internals/indexed/index_spec.rb
picky-1.4.3 spec/lib/internals/indexed/index_spec.rb
picky-1.4.2 spec/lib/internals/indexed/index_spec.rb