spec/functional/only_spec.rb in picky-4.0.5 vs spec/functional/only_spec.rb in picky-4.0.6

- old
+ new

@@ -4,49 +4,59 @@ describe 'Search#only' do it 'offers the option only' do index = Picky::Index.new :only do - category :text1 - category :text2 - category :text3 + category :category1 + category :category2 + category :category3 end - index.add Struct.new(:id, :text1, :text2, :text3).new(1, 'text1', 'text2', 'text3') + index.add Struct.new(:id, :category1, :category2, :category3).new(1, 'text1', 'text2', 'text3') try = Picky::Search.new index try.search('text1').ids.should == [1] try.search('text2').ids.should == [1] try.search('text3').ids.should == [1] try_again = Picky::Search.new index do - only :text1 + only :category1 end try_again.search('text1').ids.should == [1] try_again.search('text2').ids.should == [] try_again.search('text3').ids.should == [] - try_again.only :text2, :text3 + try_again.only :category2, :category3 + try_again.search('text1').ids.should == [] try_again.search('text2').ids.should == [1] try_again.search('text3').ids.should == [1] - try_again.search('text1:text1').ids.should == [] - try_again.search('text2:text2').ids.should == [1] - try_again.search('text3:text3').ids.should == [1] + try_again.search('category1:text1').ids.should == [] + try_again.search('category1:text2').ids.should == [] + try_again.search('category1:text3').ids.should == [] - try_again.search('text1,text2,text3:text1').ids.should == [] - try_again.search('text1,text2:text1').ids.should == [] - try_again.search('text1,text3:text1').ids.should == [] - try_again.search('text2,text3:text1').ids.should == [] + try_again.search('category2:text1').ids.should == [] + try_again.search('category2:text2').ids.should == [1] + try_again.search('category2:text3').ids.should == [] - try_again.search('text1,text2,text3:text2').ids.should == [1] - try_again.search('text1,text2:text2').ids.should == [1] - try_again.search('text1,text3:text2').ids.should == [] - try_again.search('text2,text3:text2').ids.should == [1] + try_again.search('category3:text1').ids.should == [] + try_again.search('category3:text2').ids.should == [] + try_again.search('category3:text3').ids.should == [1] - try_again.search('text1,text2,text3:text3').ids.should == [1] - try_again.search('text1,text2:text3').ids.should == [] - try_again.search('text1,text3:text3').ids.should == [1] - try_again.search('text2,text3:text3').ids.should == [1] + try_again.search('category1,category2:text1').ids.should == [] + try_again.search('category1,category2:text2').ids.should == [1] + try_again.search('category1,category2:text3').ids.should == [] + + try_again.search('category1,category3:text1').ids.should == [] + try_again.search('category1,category3:text2').ids.should == [] + try_again.search('category1,category3:text3').ids.should == [1] + + try_again.search('category2,category3:text1').ids.should == [] + try_again.search('category2,category3:text2').ids.should == [1] + try_again.search('category2,category3:text3').ids.should == [1] + + try_again.search('category1,category2,category3:text1').ids.should == [] + try_again.search('category1,category2,category3:text2').ids.should == [1] + try_again.search('category1,category2,category3:text3').ids.should == [1] end end \ No newline at end of file