spec/mongoid/fulltext_spec.rb in mongoid_fulltext-0.5.5 vs spec/mongoid/fulltext_spec.rb in mongoid_fulltext-0.5.6

- old
+ new

@@ -408,9 +408,21 @@ first_result[0].should == flowers first_result[1].is_a?(Float).should be_true end end + context "with various word separators" do + let!(:hard_edged_painting) { BasicArtwork.create(:title => "Hard-edged painting") } + let!(:edgy_painting) { BasicArtwork.create(:title => "Edgy painting") } + let!(:hard_to_find_ledge) { BasicArtwork.create(:title => "Hard to find ledge") } + + it "should treat dashes as word separators, giving a score boost to each dash-separated word" do + BasicArtwork.fulltext_search('hard-edged').first.should == hard_edged_painting + BasicArtwork.fulltext_search('hard edge').first.should == hard_edged_painting + BasicArtwork.fulltext_search('hard edged').first.should == hard_edged_painting + end + end + context "returning scores" do # Since we return scores, let's make some weak guarantees about what they actually mean let!(:mao_yan) { ExternalArtist.create(:full_name => "Mao Yan") } let!(:mao) { ExternalArtwork.create(:title => "Mao by Andy Warhol") }