require 'spec_helper' CAVERPHONE_TEST_TABLE = { 'Addis' => 'ATS111', 'Alcantara' => 'AKNTR1', 'Allegra' => 'ALKR11', 'Allende' => 'ALNT11', 'America' => 'AMRK11', 'Andera' => 'ANTR11', 'Annamarie' => 'ANMR11', 'Anya' => 'ANY111', 'Ariane' => 'ARN111', 'Arnoldo' => 'ANT111', 'Beltran' => 'PTRN11', 'Blanch' => 'PLNK11', 'Blose' => 'PLS111', 'Bodie' => 'PT1111', 'Celentano' => 'SLNTN1', 'Celestine' => 'SLSTN1', 'Charmain' => 'KMN111', 'Chelsea' => 'KS1111', 'Coleman' => 'KLMN11', 'Collis' => 'KLS111', 'Crysta' => 'KRST11', 'Culwell' => 'KW1111', 'Dilworth' => 'TWT111', 'Dinkins' => 'TNKNS1', 'Donetta' => 'TNT111', 'Dreama' => 'TRM111', 'Dulce' => 'TS1111', 'Eastwood' => 'ASTWT1', 'Eddy' => 'AT1111', 'Ellett' => 'ALT111', 'Fazekas' => 'FSKS11', 'Francesco' => 'FRNSSK', 'Gary' => 'KR1111', 'Genoveva' => 'KNFF11', 'Gossman' => 'KSMN11', 'Goudy' => 'KT1111', 'Greta' => 'KRT111', 'Gunn' => 'KN1111', 'Hackman' => 'AKMN11', 'Hassie' => 'AS1111', 'Henrietta' => 'ANRT11', 'Hollaway' => 'ALW111', 'Hulbert' => 'APT111', 'Isaacson' => 'ASKSN1', 'Ishibashi' => 'ASPS11', 'Isreal' => 'ASR111', 'Jerez' => 'YRS111', 'Joette' => 'YT1111', 'Jonathon' => 'YNTN11', 'Karin' => 'KRN111', 'Kenneth' => 'KNT111', 'Koontz' => 'KNTS11', 'Korey' => 'KR1111', 'Krystle' => 'KRSTL1', 'Landey' => 'LNT111', 'Lashaunda' => 'LSNT11', 'Legere' => 'LKR111', 'Lela' => 'LL1111', 'Louis' => 'LS1111', 'Lovely' => 'LFL111', 'Lozano' => 'LSN111', 'Margo' => 'MK1111', 'Maricle' => 'MRKL11', 'Mario' => 'MR1111', 'Mccormick' => 'MKMK11', 'Melody' => 'MLT111', 'Mike' => 'MK1111', 'Milagros' => 'MLKRS1', 'Modesto' => 'MTST11', 'Mor' => 'M11111', 'Muse' => 'MS1111', 'Neil' => 'N11111', 'Nicolas' => 'NKLS11', 'Olney' => 'AN1111', 'Pannell' => 'PN1111', 'Posada' => 'PST111', 'Raeann' => 'RN1111', 'Rameau' => 'RM1111', 'Regal' => 'RK1111', 'Renetta' => 'RNT111', 'Sachiko' => 'SKK111', 'Samira' => 'SMR111', 'Sammie' => 'SM1111', 'Sara' => 'SR1111', 'Searcy' => 'SS1111', 'Seeley' => 'SL1111', 'Shannon' => 'SNN111', 'Siegmund' => 'SKMNT1', 'Silvera' => 'SFR111', 'Sitz' => 'STS111', 'Smyth' => 'SMT111', 'Steedley' => 'STTL11', 'Teri' => 'TR1111', 'Tourville' => 'TFL111', 'Ute' => 'AT1111', 'Vernon' => 'FNN111', 'Vidaurri' => 'FTR111', 'Wolff' => 'WF1111', 'Zeck' => 'SK1111', 'Zirkind' => 'SKNT11' } describe Phonetic::Caverphone do describe '.encode' do it 'should return Caverphone value of string' do CAVERPHONE_TEST_TABLE.each do |word, code| res = Phonetic::Caverphone.encode(word) res.should eq(code), "expected: #{code}\ngot: #{res}\nword: #{word}" end end end end