spec/functional/automatic_segmentation_spec.rb in picky-4.19.3 vs spec/functional/automatic_segmentation_spec.rb in picky-4.19.4

- old
+ new

@@ -19,10 +19,23 @@ index.add OpenStruct.new(id: 5, text: 'Sun and rain.') index.add OpenStruct.new(id: 6, text: 'The king is in Spain.') index end + + context 'splitting the text automatically' do + let(:automatic_splitter) { Picky::Splitters::Automatic.new index[:text] } + + # It splits the text correctly. + # + it do + automatic_splitter.segment('purplerainbow').should == [ + ['purple', 'rain', 'bow'], + 2.078999999999999 + ] + end + end context 'splitting the text automatically' do let(:automatic_splitter) { Picky::Splitters::Automatic.new index[:text] } # It splits the text correctly. @@ -53,9 +66,15 @@ # It splits the text correctly. # it { automatic_splitter.split('purplerainbow').should == ['purple', 'rain', 'bow'] } it { automatic_splitter.split('purplerain').should == ['purple', 'rain'] } it { automatic_splitter.split('purple').should == ['purple'] } + + # Creates the right queries (see below). + # + it { automatic_splitter.split('colorpurple').should == ['color', 'purple'] } + it { automatic_splitter.split('bownew').should == ['bow', 'new'] } + it { automatic_splitter.split('spainisking').should == ['spain', 'is', 'king'] } # When it can't, it splits it using the partial index (correctly). # it { automatic_splitter.split('purplerainbo').should == ['purple', 'rain', 'bo'] } it { automatic_splitter.split('purplerainb').should == ['purple', 'rain', 'b'] } \ No newline at end of file