Sha256: 4285286cecb1016bcad144db5be61e1d3e953c94a97507faa9c94f1ebe5af90d

Contents?: true

Size: 879 Bytes

Versions: 2

Compression:

Stored size: 879 Bytes

Contents

# encoding: utf-8
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe KeywordsExtractor do
  it "should return if no text is passed" do
    KeywordsExtractor.extract("").should == nil
  end
    
  it "should return an array of keywords" do
    KeywordsExtractor.extract("keyword").class.should == Array
  end  
  
  it "should return an array of strings" do
    KeywordsExtractor.extract("keyword").first.class.should == String
  end
  
  it "should remove accents from the text passed" do
    KeywordsExtractor.extract("café").should == ["cafe"]
  end
    
  it "should downcase the text passed" do
    KeywordsExtractor.extract("CaFé").should == ["cafe"]
  end
    
  it "should split whitespaces, hifens, dots and underlines" do
    KeywordsExtractor.extract("CaFé-express.com delicious").should == ["cafe", "express", "com", "delicious"]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongoid_search-0.1.2 spec/keywords_extractor_spec.rb
mongoid_search-0.1.1 spec/keywords_extractor_spec.rb