Sha256: edd6e36980199732ce0ff651acc3e50a024e06d79c3af9d3abdda0973709014e

Contents?: true

Size: 675 Bytes

Versions: 4

Compression:

Stored size: 675 Bytes

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

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dusen-0.4.2 spec/shared/spec/dusen/util_spec.rb
dusen-0.4.1 spec/shared/spec/dusen/util_spec.rb
dusen-0.4.0 spec/shared/spec/dusen/util_spec.rb
dusen-0.3.0 spec/shared/spec/dusen/util_spec.rb