Sha256: 7dabc108b4cf9d596c16f8d2b65e5ee2d312916d2178a0398955fc1712dbd9e0

Contents?: true

Size: 866 Bytes

Versions: 67

Compression:

Stored size: 866 Bytes

Contents

require 'spec_helper'

describe Picky::API::Tokenizer do
  let(:object) do
    Class.new do
      include Picky::API::Tokenizer::Stemmer
    end.new
  end
  context 'extract_character_substituter' do
    context 'with a substituter' do
      let(:stemmer) do
        Class.new do
          def stem text
            text.gsub /computers/, 'comput' # a simple one word stemmer ;)
          end
        end.new
      end
      it 'creates a tokenizer' do
        object.extract_stemmer(stemmer).
          stem("computers").should == 'comput'
      end
    end
    context 'invalid tokenizer' do
      it 'raises with a nice error message' do
        expect {
          object.extract_stemmer Object.new
        }.to raise_error(<<-ERROR)
The stems_with option needs a stemmer,
which responds to #stem(text) and returns stemmed_text."
ERROR
      end
    end
  end
end

Version data entries

67 entries across 67 versions & 1 rubygems

Version Path
picky-4.22.0 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.21.2 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.21.1 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.21.0 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.20.2 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.20.1 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.20.0 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.19.7 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.19.6 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.19.5 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.19.4 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.19.3 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.19.2 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.19.1 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.19.0 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.18.0 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.17.1 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.17.0 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.16.0 spec/lib/api/tokenizer/stemmer_spec.rb
picky-4.15.1 spec/lib/api/tokenizer/stemmer_spec.rb