Sha256: e5f6c354c76eb225be7df1ed567ff465a0705e7bf731cfbc0ae2a115e54a3922

Contents?: true

Size: 861 Bytes

Versions: 3

Compression:

Stored size: 861 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Dusen::Parser do

  describe '.parse' do

    it 'should parse field tokens first, because they usually give maximum filtering at little cost' do
      query = Dusen::Parser.parse('word1 field1:field1-value word2 field2:field2-value')
      query.collect(&:value).should == ['field1-value', 'field2-value', 'word1', 'word2']
    end

    it 'should not consider the dash to be a word boundary' do
      query = Dusen::Parser.parse('Baden-Baden')
      query.collect(&:value).should == ['Baden-Baden']
    end

    it 'should parse umlauts and accents' do
      query = Dusen::Parser.parse('field:åöÙÔøüéíÁ "ÄüÊçñÆ ððÿáÒÉ" pulvérisateur pędzić')
      query.collect(&:value).should == ['åöÙÔøüéíÁ', 'ÄüÊçñÆ ððÿáÒÉ', 'pulvérisateur', 'pędzić']
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dusen-0.6.1 spec/shared/spec/dusen/parser_spec.rb
dusen-0.6.0 spec/shared/spec/dusen/parser_spec.rb
dusen-0.5.3 spec/shared/spec/dusen/parser_spec.rb