Sha256: d3ee982540b111aa2b39fca5111a15f074c7d734a70133448b96a59a1e258742
Contents?: true
Size: 1.5 KB
Versions: 57
Compression:
Stored size: 1.5 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' do it 'prepares and caches each' do scheduler = stub :scheduler, :fork? => false, :finish => nil @index1.should_receive(:prepare).once.with(scheduler).ordered @index2.should_receive(:prepare).once.with(scheduler).ordered @index1.should_receive(:cache).once.with(scheduler).ordered @index2.should_receive(:cache).once.with(scheduler).ordered indexes.index scheduler 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 :clear end end
Version data entries
57 entries across 57 versions & 1 rubygems