spec/fuzzily/trigram_spec.rb in fuzzily-0.0.1 vs spec/fuzzily/trigram_spec.rb in fuzzily-0.0.2
- old
+ new
@@ -1,8 +1,23 @@
require 'spec_helper'
describe Fuzzily::String do
- it 'splits strings into trigrams'
- it 'removes accents'
- it 'removes symbols'
- it 'handles multi word strings'
+ def result(string)
+ string.extend(described_class).trigrams
+ end
+
+ it 'splits strings into trigrams' do
+ result('Paris').should == %w(**p *pa par ari ris)
+ end
+
+ it 'removes accents' do
+ result('Montélimar').should == %w(**m *mo mon ont nte tel eli lim ima mar)
+ end
+
+ it 'handles multi word strings' do
+ result('Le Mans').should == %w(**l *le le* e*m *ma man ans)
+ end
+
+ it 'removes symbols' do
+ 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