Sha256: a3da62db72b2534f267f417506dfffcf42443781312f6bab97f751783ae52f9b

Contents?: true

Size: 877 Bytes

Versions: 4

Compression:

Stored size: 877 Bytes

Contents

require 'spec_helper'

describe Phonetic::Soundex do
  describe '.encode' do
    it 'should return soundex code of word' do
      Phonetic::Soundex.encode('Ackerman').should == 'A265'
      Phonetic::Soundex.encode('Fusedale').should == 'F234'
      Phonetic::Soundex.encode('Grahl').should == 'G640'
      Phonetic::Soundex.encode('Hatchard').should == 'H326'
      Phonetic::Soundex.encode('implementation').should == 'I514'
      Phonetic::Soundex.encode('Prewett').should == 'P630'
    end

    it 'should add zeros if result less then 4 symbols' do
      Phonetic::Soundex.encode('ammonium').should == 'A500'
      Phonetic::Soundex.encode('Rubin').should == 'R150'
      Phonetic::Soundex.encode('H').should == 'H000'
    end

    it 'should return empty string for empty word' do
      Phonetic::Soundex.encode('').should == ''
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
phonetic-1.2.0 spec/phonetic/soundex_spec.rb
phonetic-1.1.0 spec/phonetic/soundex_spec.rb
phonetic-1.0.1 spec/phonetic/soundex_spec.rb
phonetic-1.0.0 spec/phonetic/soundex_spec.rb