Sha256: db9fe89a46cd599a5d569cf9cfcc7073eb24b18ac41056cad1980f2edafb1911
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 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' 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dusen-0.4.3 | spec/shared/spec/dusen/util_spec.rb |