spec/lib/indexing/bundle/redis_spec.rb in picky-2.7.0 vs spec/lib/indexing/bundle/redis_spec.rb in picky-3.0.0.pre1

- old
+ new

@@ -1,12 +1,12 @@ require 'spec_helper' -describe Indexing::Bundle::Redis do +describe Picky::Indexing::Bundle::Redis do before(:each) do - @index = Index::Memory.new :some_index, source: [] - @category = Category.new :some_category, @index + @index = Picky::Indexes::Memory.new :some_index, source: [] + @category = Picky::Category.new :some_category, @index @partial = stub :partial @weights = stub :weights @similarity = stub :similarity end @@ -57,40 +57,40 @@ end end describe 'retrieve' do before(:each) do - files = stub :files - files.should_receive(:retrieve).once.and_yield ' 1234', :some_token - index.stub! :files => files + prepared = stub :prepared + prepared.should_receive(:retrieve).once.and_yield ' 1234', :some_token + index.stub! :prepared => prepared @ary = stub :ary inverted = stub :inverted, :[] => @ary index.stub! :inverted => inverted end context 'id key format' do before(:each) do - index.should_receive(:[]).once.with(:key_format).and_return :to_i + @category.stub! :key_format => :to_i end it 'should call the other methods correctly' do @ary.should_receive(:<<).once.with 1234 index.retrieve end end context 'other key format' do before(:each) do - index.should_receive(:[]).once.with(:key_format).and_return :strip + @category.stub! :key_format => :strip end it 'should call the other methods correctly' do @ary.should_receive(:<<).once.with '1234' index.retrieve end end context 'no key format - default' do before(:each) do - index.should_receive(:[]).once.with(:key_format).and_return nil + @category.stub! :key_format => nil end it 'should call the other methods correctly' do @ary.should_receive(:<<).once.with 1234 index.retrieve \ No newline at end of file