Sha256: e5c8ec1d2680f0dc3a3eb4be1b0d2bea57ac1f9f724bb06e16aaf872ac520b58
Contents?: true
Size: 1.29 KB
Versions: 13
Compression:
Stored size: 1.29 KB
Contents
require 'spec_helper' describe Dusen::Util do describe '.boolean_fulltext_query' do it 'should generate a query for boolean MySQL fulltext search, which includes all words and allows additional characters on the right side' do Dusen::Util.boolean_fulltext_query(['aaa', 'bbb']).should == '+aaa* +bbb*' end it 'should keep phrases intact' do Dusen::Util.boolean_fulltext_query(['aaa', 'bbb ccc', 'ddd']).should == '+aaa* +"bbb ccc" +ddd*' end it 'should escape characters that have special meaning in boolean MySQL fulltext searches' do Dusen::Util.boolean_fulltext_query(['+-~\\']).should == '+\\+\\-\\~\\\\*' end end describe '#normalize_word_boundaries' do it 'should remove characters that MySQL would mistakenly consider a word boundary' do Dusen::Util.normalize_word_boundaries("E.ON Bayern").should == 'EON Bayern' Dusen::Util.normalize_word_boundaries("E.ON E.ON").should == 'EON EON' Dusen::Util.normalize_word_boundaries("E;ON").should == 'EON' Dusen::Util.normalize_word_boundaries("Baden-Baden").should == 'BadenBaden' end it 'should remove characters that MySQL would mistakenly consider a word boundary' do Dusen::Util.normalize_word_boundaries("Foobar Raboof").should == 'Foobar Raboof' end end end
Version data entries
13 entries across 13 versions & 1 rubygems