spec/lib/indexing/bundle_spec.rb in picky-3.4.2 vs spec/lib/indexing/bundle_spec.rb in picky-3.4.3

- old
+ new

@@ -78,15 +78,23 @@ end end describe 'retrieve' do before(:each) do + @ary = [] + prepared = stub :prepared - prepared.should_receive(:retrieve).once.and_yield ' 1234', :some_token + prepared.should_receive(:retrieve).once.and_yield(' 1', :some_token) + .and_yield('1 ', :some_token) + .and_yield('1', :some_token) + .and_yield(' 2', :some_token) + .and_yield('3', :some_token) + .and_yield(' 3 ', :some_token) + .and_yield(' 1234', :some_token) + bundle.stub! :prepared => prepared - @ary = [1,1,1,2,3,3] @inverted = stub :inverted, :[] => @ary bundle.stub! :inverted => @inverted end context 'uniqueness' do before(:each) do @@ -102,30 +110,39 @@ context 'id key format' do before(:each) do @category.stub! :key_format => :to_i end it 'should call the other methods correctly' do - @ary.should_receive(:<<).once.with 1234 + @ary.should_receive(:<<).once.ordered.with 1 + @ary.should_receive(:<<).once.ordered.with 2 + @ary.should_receive(:<<).once.ordered.with 3 + @ary.should_receive(:<<).once.ordered.with 1234 bundle.retrieve end end context 'other key format' do before(:each) do @category.stub! :key_format => :strip end it 'should call the other methods correctly' do - @ary.should_receive(:<<).once.with '1234' + @ary.should_receive(:<<).once.ordered.with '1' + @ary.should_receive(:<<).once.ordered.with '2' + @ary.should_receive(:<<).once.ordered.with '3' + @ary.should_receive(:<<).once.ordered.with '1234' bundle.retrieve end end context 'no key format - default' do before(:each) do @category.stub! :key_format => nil end it 'should call the other methods correctly' do - @ary.should_receive(:<<).once.with 1234 + @ary.should_receive(:<<).once.ordered.with 1 + @ary.should_receive(:<<).once.ordered.with 2 + @ary.should_receive(:<<).once.ordered.with 3 + @ary.should_receive(:<<).once.ordered.with 1234 bundle.retrieve end end end \ No newline at end of file