spec/fuzzily/trigram_spec.rb in fuzzily-0.2.0 vs spec/fuzzily/trigram_spec.rb in fuzzily-0.2.1
- old
+ new
@@ -1,24 +1,25 @@
# encoding: utf-8
require 'spec_helper'
describe Fuzzily::String do
def result(string)
- string.extend(described_class).trigrams
+ described_class.new(string).trigrams
end
it 'splits strings into trigrams' do
- result('Paris').should == %w(**p *pa par ari ris)
+ result('Paris').should == %w(**p *pa par ari ris is*)
end
it 'removes accents' do
- result('Montélimar').should == %w(**m *mo mon ont nte tel eli lim ima mar)
+ result('Montélimar').should == %w(**m *mo mon ont nte tel eli lim ima mar ar*)
end
it 'handles multi word strings' do
- result('Le Mans').should == %w(**l *le le* e*m *ma man ans)
+ result('Le Mans').should == %w(**l *le le* e*m *ma man ans ns*)
end
- it 'removes symbols' do
+ it 'removes symbols and duplicates' do
+ # The final ess, sse, se* would be dupes.
result('Besse-en-Chandesse').should == %w(**b *be bes ess sse se* e*e *en en* n*c *ch cha han and nde des)
end
end
\ No newline at end of file